Parent/Child themes – both CSS files loaded
Parent/Child themes – both CSS files loaded
Parent/Child themes – both CSS files loaded
Your get_template_part call is successful, it’s the file it loads that is broken <?php get_template_part( ‘partials/category’ ); ?> If you swap the contents of that file for this: <p>Hello World</p> Then it will work as expected. The cause of your problem is this: require_once WP_PLUGIN_DIR.’/themename/includes/file1.php’; you should not be including files from other themes directly … Read more
Found it: The posts I’m working with are instances of custom posts, and the default get_posts() function assumes that posts are just, well, posts. So it wasn’t finding them, and was properly returning “none”. Solution: I added some code to my theme’s function.php file, like so: function set_up_theme() { …other stuff function mytheme_pre_get_posts () $query->set(‘post_type’, … Read more
Do not trigger page 404 on custom template
Looks like you have lost the homepage content. Edit the page and restore the last revision as explained here. https://www.elegantthemes.com/blog/tips-tricks/how-to-use-the-wordpress-revision-history-feature
Not tested well but you can try this. add_action( ‘template_redirect’, ‘my_homepage_redirect’ ); function my_homepage_redirect() { if ( is_home() || is_front_page() ){ $page = get_posts( [ ‘post_type’ => ‘page’, ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’, ‘fields’ => ‘ids’ ] ); if ( empty( $page ) ){ return; } // update the front page id option according … Read more
How a posts template gets loaded: You visit a WP site at a URL, /abc/xyz WP doesn’t process pretty permalinks directly, it translates them into the form index.php?var=value internally, so it runs them through all the rewrite rules until the first one matches, if none match, it’s a 404 and 404.php is loaded. This is … Read more
template with multiple post loops for multiple widgets [duplicate]
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’ ) ); }
using add_filter in a template_redirect function?