Trying to return list of child pages for a template
Trying to return list of child pages for a template
Trying to return list of child pages for a template
When trying to output a function’s content, you have to notice whether you want to pass the data to another function (or something else which you want to feed), or you want to directly print it to the browser. If you use return, your function will return the data, so you can use them in … Read more
You are using it at wrong place, You can use the same function in page.php and if you want to use it in single.php then you have to pass static pageId as parameters. Right now you are passing $post->ID which will return post id of current article and Articles does not have any relation with … Read more
Versioned Custom Post Type (Not the same as revisions)
The page itself is a custom post type, you can notice this when you open the edit page screen. Your URL will be like this: www.example.com/wp-admin/edit.php?post_type=page This means you are on a page post type. Now about your code, the first condition of your conditional determines if you are on a page post type or … Read more
I think in this case it is probably easiest to create your own function or two. I’m giving you a rough outline on how to do it below. // use the same filter to get the same results add_filter( ‘posts_fields’, ‘wpcf_create_temp_column’ ); add_filter( ‘posts_orderby’, ‘wpcf_sort_by_temp_column’ ); // perform query $q = new WP_Query( [ ‘post_type’ … Read more
How to retrieve parent menu item name of current submenu item
get_the_excerpt() won’t work in your code if you add content to the main WYSIWYG editor instead of the excerpt field. Check how get_the_excerpt() work and try to find out filter hook with get_the_excerpt hook name. Please try the following code, hope you’ll get the expected result. <div class=”parent page”> <?php global $post; $args = array( … Read more
Advanced Custom Fields dynamic update_field
You can use the save_post action to do it. I think its better than the other option to check everytime the page load because it won’t effects your clients and will not run everytime the page load. Also you need to check if its the post parent its the one that saved so you will … Read more