• Resolved hostwings

    (@hostwings)


    I’m currently using the Sparks theme by FThemes, which I’ve edited somewhat. It has a two sidebars layout, with the entry posts being in the middle.

    Was wondering if there is any way to get rid of one side bar when a user clicks on an entry. So for example, the left sidebar will stay and the entry area will widen and stretch to the right. I’m not too familiar with CSS and PHP, usually i search for the codes and modify an existing template that way.

    The ones I’ve found so far are for changing the content of a sidebar on different pages, but would like to actually delete one on all posts and pages except the home page. Would appreciate any instructions on how to carry it out. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You would have to modify the code in both page.php and single.php in your theme.

    If you wanted to remove the left sidebar you would remove the

    <?php get_template_part('content', 'before'); ?>

    piece of code in both single/page.php and if you wanted to remove the right sidebar you would remove

    <?php get_template_part('content', 'after'); ?>

    in both files.

    Of course you’ll probably have to do some CSS editing to get things to display right afterwards.

    Thread Starter hostwings

    (@hostwings)

    Thank you! Works beautifully with a little CSS tweak. Although I couldn’t remove the left sidebar for some reasons, it just messes up the whole page. But just deleting the right sidebar works fine. Out of curiosity, any ideas why that’s the case?

    The codes for single.php

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter hostwings

    (@hostwings)

    I’m guessing actually it has to do with the content-before.php

    Thread Starter hostwings

    (@hostwings)

    Ok. Figured it out by tweaking the content-before.php, index.php and header.php files.

    Once again, thanks for the tip. Really helped for me to figure out how the php works.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Changing sidebar number for posts’ is closed to new replies.