• Resolved inet

    (@inet)


    I want to add the meta and blogroll section from the sidebar to all my pages, categories, archive, etc. I tried putting:

    <?php if ( is_page() ) { ?>

    It worked, but it’s only for “When any Page is being displayed.” It excludes category and archive pages. Now how can I combine this into one line:

    <?php if ( is_page() ) { ?>
    <?php if ( is_category() ) { ?>
    <?php if ( is_archive() ) { ?>

    And is there a conditional tag that works for all pages no matter what’s in it?

    Reference: https://codex.www.ads-software.com/Conditional_Tags

Viewing 10 replies - 1 through 10 (of 10 total)
  • To restate the problem, you only want it to be displayed on individual pages such as Pages, single posts and archives but not on the front page.

    Then instead of using <?php if ( is_page() ) { ?>, work in reverse by using <?php if ( !is_home() ) { ?>
    i.e. if it’s not the home page then show this.

    Thread Starter inet

    (@inet)

    Ok great that worked, but how do i add the homepage too? So I actually want to combine:

    <?php if ( is_home() ) { ?>
    <?php if ( is_page() ) { ?>
    <?php if ( is_category() ) { ?>
    <?php if ( is_archive() ) { ?>

    Now what?

    Isn’t that everything? If that’s the case, just remove the if checks.

    Thread Starter inet

    (@inet)

    thx for fast reply, if you mean removing the if check:

    <?php if ( is_home() ) { ?>

    I tried that, then I’ll I get an error.

    Parse error: parse error, unexpected ‘}’ in /home/vhosts/greenbug.90megs.com/blogger/wp-content/themes/cleanlook/sidebar.php on line 49

    Am I doomed? what else can i try.

    You’ll also have to remove the closing } bracket as well (which is I suspect is on line 49). Give that a go and let us know how you get on.

    If you still encounter difficulties, post your code on https://pastebin.ca/ and we’ll take a quick look.

    Thread Starter inet

    (@inet)

    I see no closing bracket. Well here’s the link to code.

    https://pastebin.ca/29436

    If you want to download the theme I’m using right here:

    https://pribadi.or.id/files/cleanlook.zip

    One more thing, this is only for modifying the sidebar.php file right?

    Remove lines 23 and 50 i.e.
    remove <?php if ( is_home() ) { ?>
    and <?php } ?>

    Thread Starter inet

    (@inet)

    it workkkkkeddddd!!!!!!!!!!!!!!!!! thannnk YOUUUU!!!!!! YOur my favorite Moderator. by the way i was checking your website, are you Phy Ly? i uploaded like 2 of the theme from there, it looks great. again thanks for your expertise and time to answer my questions.

    Yep, I’m Phu Ly:) Glad it’s all sorted now:)

    I tried the advise in this thread and still come up with errors. I submitted to Pastebin: https://pastebin.ca/128614

    Can anyone assist?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Combining Conditional Tags? For sidebar display.’ is closed to new replies.