Helpdesk for best responsive menu plugin
Home › Forums › Pro Support › Call php file in html content at header bar
Hi I love this plugin.
I have used php in html content at header bar. Using short code to call php file.
It works really good, but I got stacked when I set below code as sub-loop.
'numberposts' => -1,
'category_name' => 'puppy',
'order' => 'ASC',
<?php wp_reset_postdata(); ?>
I use this code to show some values of custom field.
When I set this code on single.php, I can not get correct post_id only at html content space of Responsive menu pro.
It does not show correct post_id, and it shows very first post_id that belongs to the category of puppy in above case.
Is there any way to solve this problem?
Welcome to Responsive Menu Support Forum. Hopw you are doing good.
I am forwarding your issue to the development team. I will be back to you soon.
This has nothing to do with our plugin.
In a WordPress theme, in order to show a value from post meta or custom field, you need to use the function get_post_meta
Which by default will use the post id of a particular post, if it is in single.php
If not, you will need to provide the post id.
In single.php of a theme, there is only the post id of that particular post in the global $post variable.
There is nothing wrong with this. To show a list of posts in a category, you need to use WP_Query class ( https://developer.wordpress.org/reference/classes/wp_query/ )
We suggest you to ask for help in WordPress.org forum, if you requires further assistance.