Change the template when the user is not logged in using page_template filter (it does not work)

Your code doesn’t really do any “user logged in” check, and you aren’t using a couple of the globals you import. function restrict_access_to_unlogged_users($template) { if (!is_user_logged_in()) { $template = get_stylesheet_directory() . ‘/need-login.php’; } return $template; } add_filter( ‘page_template’, ‘restrict_access_to_unlogged_users’, 20 ); And you could do this more globally with template_include. function restrict_access_to_unlogged_users($template) { if (!is_user_logged_in()) … Read more

the_content of template page

Have you tried using the whole loop? <?php $loop = new WP_Query(); if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); ?> <!– before –> <?php the_content(); ?> <!– after –> <?php endwhile; else: ?> <p><?php _e( ‘Nope. Doesn\’t exist’ ); ?></p> <?php endif; ?>

How do I override plugin templates and stylesheets?

So long as a plugin / theme doesn’t use the dreaded !important rule in their CSS files, you should be quite alright to include your own CSS, and over-ride their settings. However some very badly written plugins / themes do use the !important rule, which unfortunately makes it difficult or even impossible to over-ride their … Read more

Genesis – Adding custom hooks to display secondary navigation

Yes. you can do that. function my_custom_footer() { ?> <div class=”site-footer-logo”> <img src=”https://wordpress.stackexchange.com/questions/179519/<?=get_stylesheet_directory_uri();?>/images/my-logo-small.png” alt=”My Logo Small” /> </div> <?php do_action(‘my_own_hook’); ?> <p>Copyright &copy; <?=date(‘Y’);?>, my-url.com.</p> <?php } add_action( ‘my_own_hook’, ‘genesis_do_subnav’ ); function genesis_do_subnav(){ wp_nav_menu( array( ‘theme_location’ => ‘secondary-menu’ ) ); } You also can directly add: </div> <?php wp_nav_menu( array( ‘theme_location’ => ‘secondary-menu’ ) ); … Read more

Page template for a site from network

You could use the filter theme_page_templates present since 3.9.0 like so: function my_theme_page_templates( $page_templates, $this, $post ) { $travel_blog_id = 2; $blog_id = get_current_blog_id(); if($blog_id != $travel_blog_id) { if(isset($page_templates[‘page-travel.php’])) { unset($page_templates[‘page-travel.php’]); } } return $page_templates; } add_filter( ‘theme_page_templates’, ‘my_theme_page_templates’, 20, 3 );

Make child taxonomy categories use a set template

WordPress has a Template Hierarchy – specifically for taxonomies and terms. So what template name you want should follow along the lines of: taxonomy-{$taxonomy}-{$term-slug}.php In your case: taxonomy-classifications-cheese.php This will grab onto the cheese category and display this specific template. I’m not entirely sure if this will also catch child categories ( I would test … Read more

How can I use archive-{post_type}.php theme template?

Custom post type archive page does not need “dumb” Page. In fact, there could be the culprit. You should try this: Remove /* Template Name: Staff */ from archive-staff_member.php (not needed) Remove “dumb” stuff Page (if created). There could be some permalink conflict. Go to Admin > Settings > Permalinks and re-save it (it will … Read more