functions that return a single boolean value depending on what is currently being viewed

learn more… | top users | synonyms

0
votes
1answer
9 views

How to conditionally output to sidebar of each author's archive and posts by each author?

Specifically, I am trying to conditionally hook a testimonial rotator into the sidebar of specific author archives and single posts for each specific author. Although I am using a specific example ...
0
votes
0answers
22 views

Custom metabox fields not saving when limited to a certain CPT

I have a series of CPTs, each with their own custom metaboxes. They all work great - display where they should, saving how they should. One issue I have found though is that they also ALL run their ...
0
votes
1answer
20 views

Can not hook into custom post type template with: is_page() conditional?

I am using a custom post type: FAQ, to create an ongoing page of FAQ items. I have created a custom template: faq-template.php, to display the items. I need to hook other elements into the bottom ...
1
vote
1answer
26 views

Targeting specific pages in the loop

I am having a custom query that calls in pages in an array like so: <?php $args = array( 'post__in' => array( 2, 7, 9, 11, 13 , 15, 17 ), 'post_type' => 'page', 'orderby' => ...
0
votes
1answer
28 views

Best Method to Switch Between Terms (Custom Taxonomy)

Looking to learn something, here. With the following code, I am loading an external file for each condition based on a known set of custom terms. I'm using has_terms to check for a specific value ...
0
votes
1answer
38 views

Displaying message if no posts in tag

I am trying to modify the archive.php file to display a message if there are no posts. I was wondering what the code would be to do this. Here is what i am working with: <?php /* Template Name: ...
-1
votes
3answers
58 views

is_home , is_front_page not working

i tried many conditions to my footer.php section to include this function in my front page only and not on blog page...but it just pops up on both pages or none of them...can anyone explain the fault ...
0
votes
1answer
33 views

From my Plugin Settings Page use check boxes to load specific css files (e.g. Bootstrap / Foundation)

This is my first post on here so bare with me if something goes terribly wrong. The wp plugin I am building requires bootstrap for the shortcodes it generates to be styled as expected when rendered ...
0
votes
1answer
44 views

how could I load a different template part by page

I would like to use get_template_part(); to load a different template parts on different pages. so on the home page it loads get_template_part( 'content', 'home' ); and on the blog page it would load ...
0
votes
0answers
30 views

WordPress Tags and Hierarchy (Parent - Child relation)

I'm curious why WordPress wouldn't support the parent->child hierarchy in tags taxonomy, so let's say if you have a tag: Cities (which is parent) and this one will have the cities listed as child ...
0
votes
1answer
17 views

Image to only show up in the single post page, not on the blog/home page

I'm new to WP, and I'm working on a custom theme. Images in posts show up not just on the single post page, but on the blog/home page too(where the recent posts are listed). I want them to only show ...
3
votes
1answer
62 views

What is the correct method for determining 'is_front_page' when using filters such as 'pre_get_posts' and 'posts_where'?

On my site several filters should be applied if the user is viewing the static home page. My understanding is that is_front_page() should determine if that is indeed the case. However, whenever I ...
0
votes
0answers
36 views

WordPress Conditionals Giving Me A Headache

I have a WordPress Foundation theme I have developed called WP-Forge. Here is the link if you would like to look so you can get a general idea of what I am talking about. I have received a lot of ...
0
votes
1answer
30 views

Auto-Tagging a Custom Post Type

I have a custom post type called 'community' and I am trying to automatically generate the tag 'community' upon publishing anything from that custom post type. In layman's terms, a kind of 'if this is ...
0
votes
1answer
47 views

if user is admin display admin link and logout link else display logout only

Like the title suggest I would like to create a conditional with the ability to if user is admin display admin link and logout link else display logout only in wordpress. I have created this ...
1
vote
1answer
24 views

Need help targeting a custom post type with conditional tags

I found some code online to create content blocks on my WordPress blog. I use a content block at the bottom of the sidebar of my page for a shopping widget. Here's the relevant code from ...
0
votes
1answer
70 views

PHP inside echo HTML?

I am a little bit confused about the following code: <?php if (is_home() ) { echo '<div id="bg" style="background:url("assets/img/header_1.jpg");">'; } else ( is_page( 52 )) { echo '<div ...
0
votes
1answer
110 views

Advanced Custom Fields: Conditional Statement with Select

I've set up a select field labeled "asset_type" with two values: "image" and "video". I then have two fields that rely on conditional logic to be displayed. If "image" is selected from the select I ...
1
vote
1answer
28 views

Why would this IF statement not work? [closed]

I've placed the following conditional statement in my footer.php file but it isn't working. I want it to show the footer on every page except for single.php and the services.php template: <?php if ...
0
votes
1answer
35 views

Conditional read more adjustment

I get the read more link like this <?php the_content("Read More"); ?> I want on the Homepage a different text than on an archive pages. I can change the text for all read more links in ...
0
votes
2answers
38 views

if statement for featured images

I'm just looking to make sure my home page and pages display my featured image if set, and other wise if not set show blog-banner.jpg. So that's what I thought I had however now my 404 error page ...
0
votes
1answer
20 views

Conditional statements in wordpress themes

I have the following code at the start of my single.php loop that displays the post featured image as a background. <?php $featured_background = wp_get_attachment_image_src( ...
0
votes
1answer
48 views

Hide Image Container if No Image Attachments

I have a CPT that displays any attached images via a slider. However, when there are no attached images the slider still appears. Is there a way to add a conditional IF statement that will hide the ...
0
votes
1answer
45 views

How to run filter only on custom post type edit screen

I am trying to force minimum width and height requirements on featured image upload on a particular post type only. My minimum width/height code is ok, as it works just fine on all post types. I am ...
-1
votes
1answer
48 views

Including 2 Negative Is_Template Conditionals in header.php [closed]

I want to set a conditional in header.php to wrap all of my templates, except front-page.php and single-device.php, in a bootstrap container element. Writing one conditional achives what I want if( ...
0
votes
2answers
59 views

Echo tags with an if statement and display php inside of the IF?

I am having issues displaying tags only if there is tags and including php inside of it as well. This is what I tried but nothing is showing. <?php if( has_tag() ) { ?> <!-- Start of ...
0
votes
0answers
14 views

Condition for new user in wordpress

Here i'am using the theme registration field. Where I added the two option field one is for 5 mile distance and the other is for 10 mile distance, If any new user sign up and choose the 5 or 10 mile ...
0
votes
1answer
35 views

Add code only for blog posts

I am trying to run a code only in blog posts, and another code only in single pages. But I can't even make a single working php if statement, that contains a wordpress conditional tag. In footer.php, ...
0
votes
2answers
61 views

If page displays posts conditional

So I'm displaying 3 different layout types, one for pages, one for posts (blog, archives, tags, search etc..) and one for single posts. Originally, I was using this to decide whether I was on a page ...
0
votes
2answers
72 views

Load CSS conditional on custom field is present

In my functions.php I would like to enqueue a CSS file conditional on whether a custom field exists on the page or custom post type. How should I go about this? function flatsome_scripts() { ...
0
votes
1answer
48 views

Displaying Content Only in Certain Page IDs Not Working

So I am using IDs inside the page array, and they worked fine for weeks. Now, for some reason ONE page with ID 383 still displays the form even though its ID is not mentioned in the code. <?php if ...
0
votes
0answers
19 views

The title of an attachment is not working

I use this function to assign the title of every page: function my_title() { switch ( true ) { // [...] case (is_attachment()): wp_title(''); // This doesn't work ...
0
votes
1answer
43 views

Which is the right order of the conditional tags on pages?

I need to develope a structure where I use all the conditionals for every type of page, post and archive. On WordPress we have these pages (extracted from a template hierarchy): Error 404 Page ...
-2
votes
2answers
39 views

Is front_page conditional issue

I created a Conditional statement where there are two types of the header. One if its the front_page, the other for all internal pages. My issue is, I have a conditional based front page where the ...
0
votes
1answer
75 views

Display a div when post has a certain tag

I'm currently developing a wordpress blog site but I think this question maybe a bit of JS magic at the same time so put it here rather than Wordpress Development. I'm looking to create a post and ...
2
votes
1answer
89 views

Conditional tag search-no-results

Is there a way to make a conditional tag that tests if it is search-no-results page? I know that there is a function to check if is_search() page: if(is_search()){ echo "search page"; } But I ...
0
votes
1answer
30 views

Conditionally print css style in Wordpress

I posted this on Stackoverflow and as suggested I am reposting it here if thats ok. Didnt knew there was a Wordpress section of the site :) I am working on a Wordpress theme and want to give the ...
0
votes
1answer
74 views

Hide breadcrumbs on specific pages

Can anyone help me to hide breadcrumbs from certain page ID's? I'm using the Breadcrumb NavXT plugin. I've only found out how to hide it from the home page. I'm using this code in my header.php: if ...
0
votes
2answers
128 views

Dequeuing scripts for all pages but the home page

I'm trying to dequeue some scripts from a plugin that I only need for the home page. For the home page, I'm using a file called front-page.php with this on top to make it a home template: <?php /* ...
0
votes
1answer
37 views

unsetting required fields in the comment reply form

Is there a way to make differences between the normal comment form and the reply-to-form? For example, I added a set of required radiobuttons to the form which make rating by commenting happen. Now, ...
0
votes
1answer
124 views

How can I display a div ONLY if it is not a certain term page

Ok so I have two Custom Taxonomies of "Types" and "Countries" with dozens of terms. I basically use the terms of "Types" and "Countries" as a filter for my products in my taxonomy.php Now Those 2 ...
0
votes
1answer
40 views

Pre Get Posts - Difference between conditional() and $query->conditional()?

This may be a poor question but inside pre_get_posts() is there any real difference between $query->conditional() versus just adding the conditional() ? Take the following example: /** Themes Pre ...
0
votes
1answer
15 views

My Conditional Tags not Working

I'm just a starter in WordPress. I found the one I'm looking for but I can't make it work. I want to add a script when the travel page is shown and it's hidden when the user navigates to the rest of ...
0
votes
0answers
31 views

Custom taxonomie conditionnal

I need to create a conditional with custom taxonomy/tag. Let me explain the concept: The website is based on user's contribution (fitness/body building performances). A member create a new post and ...
0
votes
1answer
25 views

Comparison Operators not working for conditional author post thumbnails

I'm trying to place the default featured image on the blog index page with an image to be determined by who the author of the post is. For some reason I'm getting the image for $author_id=2 even when ...
0
votes
0answers
84 views

Widget area to full width layout only

I want to add a new widget area that will only display if the layout is full page (no sidebars). There doesn't seem to be a WordPress conditional based on layout. Is there a way to do this?
2
votes
1answer
91 views

Conditional tag for all categories of a custom post type

I need a conditional tag which returns true on all categories added to a specific custom post type. Tried dozens of variations using the conditional tags from the Codex but still stuck. What i'm ...
0
votes
1answer
201 views

ajax wp_query conditional tags not working

I'm trying to ajax wp_query, I got success getting posts for home page with the following code. Then I added conditional tags to modify the query for the other pages like Category page the problem ...
-1
votes
1answer
50 views

Load slideshow.css file only if Slideshow is checked / on

I use <?php if ( get_option('mytheme_slider') == 'checked') { get_template_part( 'partials/slider/slider-java-script' ); } ?> to include the slider-java-script.php template part into my site. ...
0
votes
1answer
100 views

If tag equals then show else show

In my WordPress I have a page template called: single_jobs.php In the template is shown a contact formular. Linked in the template file like this: <?php echo do_shortcode( '[contact-form-7 ...