Need post_type_archive_title function but in ‘single’

I’m trying to pull a custom post type name/title out for use in the breadcrumb of a single-[cpt].php template file. In the archive-[cpt].php I can use post_type_archive_title() and it echo the name. How would I get this same title in a single view? Thanks! I’ve trawled though the codex and haven’t seen a function, but … Read more

Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)

I’m using the following to bring up a tag archive page: <?php query_posts( “tag=”. ” . single_tag_title( ”, false ) . ” ); ?> This works perfectly for all tags of one word only, but any tags of more than one word (eg: “tag one”, slug: “tag-one”) do not display. Is it possible to query_posts … Read more

Show scheduled posts in archive page

I’d like my archive.php page’s daily view (is_day) to display scheduled posts (post_status=future). For example, if I go to mysite.com/2011/05/20 I would see all posts scheduled to appear on May 20. The archive page’s loop starts with: if ( have_posts() ) the_post(); and ends with: rewind_posts(); get_template_part( ‘loop’, ‘archive’ ); Do I need to make … Read more

Use is_product_category() properly

I have two product category MULTILINGUAL DIGITAL MARKETING (ID 75) INTERNATIONAL SALES CHANNELS (ID 107) I want to run some code via if condition for these two category only. I tried using this code but it didn’t worked if( is_product_category(107 || 75) ) { $term = get_queried_object(); $parent = $term->parent; if (!empty($parent)) { $child_of = … Read more

Adding active/current class to get_terms list

I have a list of terms I’m displaying using “get_terms”. Each term is linked so if the user clicks it, they go to the term archive page. <?php $terms = get_terms(‘category’);t echo ‘<ul>’; foreach ($terms as $term) { echo ‘<li><a href=”‘.get_term_link($term).'”>’.$term->name.'</a></li>’; } echo ‘</ul>’; ?> However, I would like to know if there’s a way … Read more

Custom post type tag archives don’t work for basic loop?

I have registered a custom post type with the right parameters. By that I mean I have added ‘taxonomies’ => array(‘post_tag’,’category’), I have also tried using register_taxonomy_for_object_type(‘post_tag’, ‘custom-post-type-name’); I have a custom function in my functions.php to load a basic loop using a conditional, along the lines of. function child_maybe_do_grid_loop() { if( is_tag() || is_category() … Read more

Display “add to cart” button on every listing in product category page?

I need to place Add to cart button at every product on the page of certain category as shown below How can I achive this? Link to subject page oma-fintess.com.ua 4 Answers 4 You can use the WooCommerce hook woocommerce_after_add_to_cart_button. This hook will add content after the “Add To Cart” button. If the customer clicks … Read more

Page queried instead of a custom taxonomy

When I try to get an archive for a custom taxonomy, WP searches for a page and doesn’t find anything. The Setup My code from the functions.php: add_action( ‘init’, ‘register_store_taxonomy’ ); function register_store_taxonomy() { $args = array ( ‘hierarchical’ => TRUE , ‘label’ => ‘Store’ , ‘public’ => TRUE , ‘query_var’ => ‘store’ , ‘rewrite’ … Read more

How can I get archives for specific category without category_base in the url?

I’m using this code to get archives for a specific category: function extend_date_archives_add_rewrite_rules($wp_rewrite){ $rules = array(); $structures = array( $wp_rewrite->get_category_permastruct() . $wp_rewrite->get_date_permastruct(), $wp_rewrite->get_category_permastruct() . $wp_rewrite->get_month_permastruct(), $wp_rewrite->get_category_permastruct() . $wp_rewrite->get_year_permastruct(), ); foreach( $structures as $s ){ $rules += $wp_rewrite->generate_rewrite_rules($s); } $wp_rewrite->rules = $rules + $wp_rewrite->rules; } add_action(‘generate_rewrite_rules’, ‘extend_date_archives_add_rewrite_rules’); It works fine and I get an URL like: … Read more