0
votes
2answers
43 views

If Month=Particular month display content [closed]

I want to use conditional tag to display content according to month. Such as if it is April, it should show something else something else. Right now I am using : <?php if(is_month() == '2' ) : ...
0
votes
1answer
54 views

“if parent category is” conditional?

I searched through the codex but couldn't find anything helpful. I tried the code below but it didn't work. The default sidebar still shows up for all category pages. <?php ...
0
votes
1answer
83 views

conditional tags for the output of a plugin

I'm still quite a newbie developer so small problems like this bring me to a stand still from time to time. I've basically built a custom plugin to display pdf images next to a link very basic I ...
0
votes
3answers
116 views

Conditional for Post Format

I want to to show a specific content on the top of each post (on single page) depending of the post-type. If it's normal, show something, if it's gallery, show another. By now the code is like this: ...
0
votes
2answers
381 views

Don't show certain div on front page?

I have CSS issues with a certain div only on the front page (front-page.php). As I can't fix it, I was thinking about removing the item, but only on the front-page. I'm not exactly sure how I have to ...
0
votes
1answer
817 views

conditional statement for custom taxonomy

Struggling to find out how to achieve this, if it is at all possible. The equivalent of is_category but for a custom taxonomy I've set up. The taxonomy category if which being Taxonomy Name with 2 ...
1
vote
1answer
565 views

Conditional statement for parent, child and grandchild pages

I'm trying to figure out how to set up a conditional statement to check if the parent, child or grandchild is being displayed. This is what I've got so far: <?php if ( is_page( 'about' ) || '29' ...
0
votes
1answer
283 views

advanced custom fields: repeater field within conditional statement [closed]

I'm trying to figure out if it's possible to have a custom field within a conditional statement. e.g— if ( is_page( 'about' ) || '29' == $post->post_parent ) { //custom field goes ...
0
votes
1answer
47 views

conditional: if is page, and all subpages

What I'm currently trying to achieve is displaying certain menus on certain pages using one template and conditional statements, like so: if (is_page('donate')){ wp_nav_menu(array( 'menu' ...
1
vote
2answers
183 views

Output 2 items within the Loop

I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one? // 5 list items ...
0
votes
1answer
163 views

If 'editor' is empty, then

Is there a way to write a php conditional in WordPress that says: "If 'editor' is not filled out (i.e. empty), then, do some code..." I know it's sort of a strange request but basically I have a ...
-1
votes
1answer
1k views

Woocommerce getting top level category parent and make all sub categories have the same template and menu

I want to get the top level category parent which is "wedgwood" so i give it a different menu and different template that what i wrote so far but it dont apply except on ‘wedgwood’ category wegdwood ...
0
votes
1answer
657 views

Check if current page is wp-admin

I have created a common custom dashboard for my users located at "http://website.com/login/dashboard/" I'm trying to redirect users to that custom dashboard only if they are NOT admins & if the ...
0
votes
1answer
860 views

Add class to DIV depending on page loaded

I'm designing a new theme and in my page template a have a section where an image is displayed . I would like this image to change depending on which page is loaded. The section is a DIV like this: ...
0
votes
1answer
264 views

How to echo a different field if another field is empty?

I succeeded in getting both images and video to echo into a bootstrap carousel. However, I run into a problem when the post contains no images. If there are no images then there is no class="item ...
0
votes
1answer
96 views

Adding else if conditional statement to purchased theme

I purchased a theme that I want to change a bit. I'm familiar with writing some if/else statements but not this type and not matter what I do, I can't add an else/if without breaking the code. Below ...
0
votes
2answers
99 views

page 1 is not paged

I have rules that only work on paginated pages (is_paged). However, they don't work on page number one (/page/1). This one is behaving exactly like the homepage (!is_paged), but unlike pages 2,3,4 ...
0
votes
3answers
2k views

Show content if parent page has children

Using this piece of code you can show content depending if it's a child-page or not: <?php global $post; if ( is_page() && $post->post_parent ) : ?> This is a child-page. <?php ...
0
votes
2answers
121 views

Trying to use Ternary operators with WP Conditionals

Hi I am trying to use ternary operators with WordPress condtionals, using the code below, but it's giving me a PHP error, what am I doing wrong? echo is_home() : '1' ? '0';