• In my current theme, when you choose to view a single article/post the side-bar is removed, leaving a limited navigation for the user.

    https://www.davidairey.com/blog

    How can I alter the coding so that once a user views one single post the side-bar is still in view (rather than removing it)?

Viewing 1 replies (of 1 total)
  • Create a new sidebar for single post entries. You can call it whatever you like ie: sidebar1, sidebar2 or singlesidebar.php

    Upload this sidebar (designed in a plain text editor) to your server (current theme) ie: wp-content/themes/yourcurrentheme folder and go to Admin >> Presentation >> Theme Editor >> your current theme

    Open single.php and delete <?php get_sidebar(); ?> and insert this instead:

    <?php include ('singlesidebar.php'); ?> and your new sidebar will be used on all single post views instead of the original sidebar.
    You can add anything you like to your new sidebar to craft it to look the way you want without destroying the original. The original sidebar will still be used for all other views.
    If you have only Main Index, which is generating single post views, then you’ll need to create a single.php (just copy main index and save as single.php) and upload to your current theme. Do the above to your single.php, changing the call for singlesidebar.php.`

    You can read more on Template Hierarchy here:
    codex.www.ads-software.com/Template_Hierarchy

Viewing 1 replies (of 1 total)
  • The topic ‘Keeping the side-bar when viewing single posts’ is closed to new replies.