Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Hiding content – CSS or Php?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #187033
    Ayanize
    Participant

    Hi,

    I know how to hide a content using CSS and also with php. However, which would be advisable?

    My scenario –

    I have added a footer widget (e.g. Recent Posts) out of the 4 listed ones in a WP site. Now, on a particular page, I wish to display this widget (e.g. Recent Posts) but make it hidden or removed from rest of the site.

    I tried with the conditional tags in php and also with CSS display:none;.
    separately.
    \#recent-posts-5 {
    display:none;
    }
    .page-id-123 #recent-posts-5 {
    display:block;
    }
    <code></code>

    Now, which will be good and advisable, in terms of 5EO, page speed performance and usability across almost all devices.

    Many thanks.

    Kalyan

    #187109
    Paulie_D
    Member

    Firstly, if you mention ESS EE O in a post here it will get flagged as spam.

    Use 5EO instead

    Secondly which is preferable is a decision for you.

    If you serve the page but hide the element with display:none it will get read and indexed by web spiders and other search engines…if you don’t serve it all, using PHP, it’s not in the source code to start with so it won’t.

    Insofar as this only to be hidden on a single page and displayed on all the others, I’d go the display:none route…simpler all round.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.