WordPress.org

Support

Support » Plugins and Hacks » Widget Logic » [Plugin: Widget Logic] How do I use widget logic to link to more than one page?

[Plugin: Widget Logic] How do I use widget logic to link to more than one page?

  • I am designing a website for someone who arranges work placements in the UK for Italian and Slovenian students, so I need my site to be available in all three languages. I have decided not to use translation software as the translations aren’t very good, so am making 3 versions of each page.

    I have made 3 links using images of the three flags, and I want the home page to link them to the other versions of the home page and so on.

    I can get the image to show on each page individually using the codes:

    is_front_page()
    is_page(‘Casa’)
    is_page(‘Domov’)

    Is there a way to put all of these in the same widget logic box so I don’t have to make 3 widgets for each page?

    Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author alanft

    @alanft

    http://wordpress.org/extend/plugins/widget-logic/other_notes/

    You want it so that the logic returns TRUE if A or B or C are true, so join them together with the logical ‘OR’ operator which is two bars:

    A || B || C

    Thankyou!

    I have tried (!is_page('1438') || !is_home()) to exclude widgets from the home page and page 1438, but the widgets still appear on these pages.

    If I do
    !is_page('1438') the widget does not display on page 1438 or,
    !is_home() the widget does not display on the home page.

    I have tried (!is_page('1438') || !is_home()) and !is_page('1438') || !is_home() and have the same problem of widgets still showing.

    What am I doing wrong?

    Try:

    !is_page(1438)&&!is_front_page()

    It seems to work with && rather than || and you don’t need the brackets around it

    Thanks @lizsakia. I tried your suggestion and this does hide the widget from the front page but still not page 1438. I must admit to being a bit stumped about this.

    Oops my dyslexia got in the way. I changed the page number to 1483 and all is working! 🙂

    @lizsaskia – regarding your multi language problem, I would like to suggest you to use WPML (http://wpml.org). With this plugin you provide the translations yourself, but the plugin takes care of the whole language integration.

    Thanks Piet, that was the one I ended up using!

    I want a widget to show up on

    1. All post pages EXCEPT its own post page (“/bff-miami”)
    2. Its own category page (“/category/bike-miami”) BUT no others
    3. All pages EXCEPT one specific page (“/events”)

    What is the most concise way to do this in widget logic?

    So far I have this, but it doesn’t keep the widget off other category pages.

    !is_single(‘bff-miami’)&&!is_page(events )&&is_category(‘bike-miami’)

    SCratch that last question. I basically want to know why the following code isn’t working.

    !is_single(‘podcast-9’) || !is_page(‘events’) || is_category(‘bike-miami’)

    Right now the widget shows up everywhere.

    Plugin Author alanft

    @alanft

    Because every URL you look at will be either true for

    !is_single(‘podcast-9’)

    OR

    !is_page(‘events’)

    When on the podcast-9 post/page, it’s True that it’s not the events page and vice versa

    So what would the code be if I DON”T want the widget to show up on the post ‘podcast-9’, DON”T want it to show up on page ‘events’, and DO want it to show up in the category ‘bike-miami’?

    Very much appreciate your help. I’ve confused myself thoroughly at this point.

    Have you tried it with ‘&&’ instead of ‘||’?

    !is_single(‘podcast-9’) && !is_page(‘events’) && is_category(‘bike-miami’)

    That way it will only show up if all the conditions are true. You can also use the page number at the end of the URL instead of the keyword, and can use these in an array if you want to specify more than one page.

    Hello,

    This is not a hijacking… only a point of clarification; or moreover, in pursuit of one:

    Please, could some kind soul please provide a reference to a concise list and explanation of all operators, logical and otherwise, germane to WordPress ???

    From the posts above and from several others, I gather these to be correct – but please correct me:

    Logical Operators
    || means OR, like, either yes or no
    ! means NO, like, no way can I learn all of this stuff /* LoL */
    && means AND, like, this and that

    Then I tripped over something called Ternary Operators just as my eyes began glazing over…

    Thanks for any pointers!

    Kelly

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Plugin: Widget Logic] How do I use widget logic to link to more than one page?’ is closed to new replies.
Skip to toolbar