ACF Pro Accessing fields on a Custom Post Type
Try this code <?php $image = get_field(‘team_members_page_image’, ‘option’); ?> <div class=”post-hero-image archive-header” style=”background-image: url(‘<?php echo $image ?>’)”>
Try this code <?php $image = get_field(‘team_members_page_image’, ‘option’); ?> <div class=”post-hero-image archive-header” style=”background-image: url(‘<?php echo $image ?>’)”>
This issue has been solved by changing the code that displays posts a little. <?php $albumsongs = get_posts( array(‘post_type’ => ‘song’, ‘numberposts’ => -1, ‘meta_key’ => ‘select_song_album’, ‘meta_value’ => get_the_ID(),) ); foreach( $albumsongs as $post ){ setup_postdata($post); ?> <div> <span><?php the_title(); ?></span> <span><a href=”https://wordpress.stackexchange.com/questions/352340/<?php the_permalink(); ?>”>View</a></span> </div> <?php } wp_reset_postdata(); ?>
How to remove default modules on single event page on Modern Events Calendar
Subpages URLs for Custom Post Type
when a shortcode is defined, he has to return HTML output. then to allow the theme to customise data presentation, you can do something like that : add_shortcode(“form_step_2”, function ($attr, $content, $tag) { // preparing data //… // result to display $template_name = “form/step_2”; // search the file wp-content/themes/twentytwenty/my_plugin/form/step_2.php $template = locate_template(“my_plugin/$template_name.php”); // if the … Read more
OK, I think I have cracked it. The below code seems to work well. To be able to use a custom post type I added an argument into the $args array’post_type’ => ‘product’, Is the below OK? <div id=”sub-pages”> <?php global $post; $args = array( ‘post_type’ => ‘product’, ‘child_of’ => get_top_ancestor_id(), ‘title_li’ => ” ); … Read more
How to group custom posts in admin menu based off taxonomy/postmeta
Here you are – a plugin that is registering a Custom Post Type (CPT) and pushing template file from the plugin for that particular CPT. <?php /** * Plugin Name: WPSE352898 Template Test * Author: Mayeenul Islam * Author URI: https://mayeenulislam.github.io */ /** * Register My Custom Post Type. */ function wpse352898_register_cpt() { register_post_type(‘mycpt’, array( … Read more
Instead of is_tax(), which Determines whether the query is for an existing custom taxonomy archive page. you should use has_term(), Check if the current post has any of given terms. Like so, if ( has_term( ‘booked’, ‘room_vacancy’, $post_object ) ) { // Yay! }
The simplest way to only search a particular custom post type, and use its template for the results, is to set the action URL on the search form for the post type archive URL of your post type. Doing this means that WordPress will automatically limit results to that post type, and it will use … Read more