template with multiple post loops for multiple widgets [duplicate]
template with multiple post loops for multiple widgets [duplicate]
template with multiple post loops for multiple widgets [duplicate]
the_posts_pagination() not working if I add wp_head() to header.php
I haven’t tested this, but it looks like you just need to set an iteration variable (usually abbreviated $i), like this: <?php $i = 0; // This sets your variable $query = [ ‘post_type’ => ‘post’, ‘posts_per_page’ => 5 ]; $query = new WP_Query($query); while ($query->have_posts()) : { $query->the_post(); if($i == 0) : get_template_part(‘loops/acc-cards’); else() … Read more
I encountered something similar a few days ago when doing changes on my custom theme. If you put a file directly in the folder of your theme themes |_ bt |_ contact-me.php The contact-me.php structure <?php defined(‘ABSPATH’) || exit; // Template name: Contact me It will be available If you put it into a folder … Read more
Move the check for the query var into your title filter: add_filter(‘pre_get_document_title’, ‘wpse392764_qv_template_title’ ); function wpse392764_qv_template_title( $title ) { $foobar = get_query_var( ‘foobar’ ); if( empty( $foobar ) ) return $title; return sprintf( __( ‘%s Dynamic – %s’, ‘wpse392764’ ), esc_html( $foobar ), get_bloginfo( ‘name’ ) ); }
The problem is within the get_post function. After looking through the documentation for include() and require(), which includes the *_once() variations of the functions, the problem seemed to be that it was returning a Boolean on whether the template had been included/required or not without throwing an error. After changing how the template was requiring/including … Read more
Load templates, pass arguments, and render output from functions.php
The $atts in your template part (templates/show-taxonomy.php) that you passed to shortcode_atts() is not defined, so you need to define it by passing it via the third parameter for get_template_part() like this: get_template_part( ‘templates/show-taxonomy’, ”, array( ‘atts’ => $atts ) ); Then in the template part, use $args[‘atts’] to access the shortcode parameters: $atts = … Read more
using add_filter in a template_redirect function?
A certain theme is forcing it’s singular post layout