Custom Homepage As Single Page or Custom Post Type?
Custom Homepage As Single Page or Custom Post Type?
Custom Homepage As Single Page or Custom Post Type?
Unable to get the values for metaboxes for custom post type
This should work for a custom taxonomy. <?php function get_related_posts() { global $post; $taxonomy = ‘your_custom_taxonomy’; $terms = wp_get_post_terms( $post->ID, $taxonomy ); if($terms) { $term_arr=””; foreach( $terms as $term ) { $term_arr .= $term->slug . ‘,’; // create array of term slugs } $args = array( ‘showposts’ => 5, // you can change this to … Read more
There is no “fields” argument to add_meta_box(), which I assume is what you are using and not some code-bloat-ie helper function/class nonsense. And you’ve not identified a callback, which is the key. Create a callback and put your “warning” array in that, along with code to create your checkboxe/radio-boxes, or whatever you need. $wpar_meta_box = … Read more
I’m don’t know a way of re-using the page picker but you could achieve what you’re trying to do with the “Post Object” field type in the Advanced Custom Fields plugin. The post object field creates a select field where the choices are your pages + posts + custom post types. This field is useful … Read more
It seems that at that point, $post is not yet defined, you can make sure by turning debugging on. Then add this before your get_post_meta( $post…: global $post; Or you can replace $post->ID with get_the_ID().
It doesn’t look like you’re passing your search query in your WP_Query args. To do this on a custom search page try the following: Replace this: $the_query = new WP_Query(‘post_type=darpe-entries’); With this: global $query_string; $query_args = explode(“&”, $query_string); $search_query = array(); foreach($query_args as $key => $string) { $query_split = explode(“=”, $string); $search_query[$query_split[0]] = urldecode($query_split[1]); } … Read more
Please try with the wordpress in build function get_page_hierarchy( $posts, $parent ) Reference URL : https://codex.wordpress.org/Function_Reference/get_page_hierarchy
I ended up going with this type of solution. It seems to be working fine for me. I am open on ways to improve this code as it seems there is a better hook that could be used. function on_music_publish( $post_ID, $post ) { if ( $post->post_type != ‘music’ ) { return; } update_post_meta($post_ID, ‘_disable_fbc’, … Read more
This is the working code. You can try with yours $id = get_the_ID(false); $categories = get_the_category(); $parents = array(); $childs = array(); foreach($categories as $cat){ if($cat->parent == 0){ $parents[] = $cat; } else { $childs[] = $cat; } } $i = 1; echo “<div class=”sub-container”>”; foreach($parents as $parent){ if($i>3){ $i=1; echo “<div class=”clr”></div>”; echo “<hr … Read more