Web Design Forum: WordPress If Statement Issue - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

WordPress If Statement Issue Rate Topic: -----

#1 User is offline   welshhuw 

  • Web Guru
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 1,755
  • Joined: 21-October 08
  • Reputation: 20
  • Gender:Male
  • Location:South Wales, UK
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 16 January 2012 - 11:37 AM

I can't seem to target the news page on this test site: http://www.inspiredw...nbydesign/news/ here.

I am trying to get one div block to show on all pages and another div block to ONLY show on single posts, and the main News page(blog). But it does not work show on the news page at all?

Can anyone see where I am going wrong? Do I need a different way of finding out the news page?

Here is my sidebar snippet:

<?php if ( is_single() || is_page_template( 'news' ) ) { ?>

//do this...

<?php } else { ?>

//do this instead...

<?php } ?>


Thanks
0

#2 User is online   brightonmike 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,996
  • Joined: 27-June 11
  • Reputation: 340
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 16 January 2012 - 12:09 PM

templatefilename.php not template name.

e.g. news.php
0

#3 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,595
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 16 January 2012 - 12:12 PM

You can always identify the blog page with is_home(), and template it with home.php.
0

#4 User is offline   welshhuw 

  • Web Guru
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 1,755
  • Joined: 21-October 08
  • Reputation: 20
  • Gender:Male
  • Location:South Wales, UK
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 16 January 2012 - 06:24 PM

View PostRenaissance-Design, on 16 January 2012 - 12:12 PM, said:

You can always identify the blog page with is_home(), and template it with home.php.


Sorted!

I should've read the small print; I assumed is_home() was just for the home page. Doh!

Thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users