Template part including not working

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

How do I get tags linking to proper pages (/tag/sample-tag -> pages with that tag)

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

Random home page at each refresh between array of page IDs

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

WordPress change title with custom dynamic

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’ ) ); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)