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

learn more… | top users | synonyms

0
votes
0answers
24 views

WordPress redirecting issue using is_page and logged_in

I am using buddypress and want to redirect all logged in users to their profile page when they try to access login page. Below code only works if I check logged in user but not with is_page(). Also ...
0
votes
1answer
10 views

conditional based upon the count of current user's published custom posts

I have this conditional snippet that does something is the current user has not published a normal post. But I'd like to change it so that it counts a custom post rather than a normal post. <?php ...
0
votes
1answer
35 views

Conditional Tag for has post [closed]

I am quite new to all the programming, and I am now stuck with the following. I installed the plug-in If Menu which lets you show specific menu items when Conditional statements are true or false. I ...
0
votes
0answers
11 views

Check If WooCommerce Product Downloadable From Edit Screen

I'm creating a plugin for WooCommerce and I want the metabox to show only when the "downloadable" checkbox is clicked. Are there any conditionals for this when dealing with the edit page of the ...
0
votes
1answer
45 views

How to make a wordpress loop file that displays posts based on certain conditions

Am recently trying to learn the framework aspect of WordPress,so i want to build a user homepage that only displays posts from other registered users, but the posts that will be displayed will have to ...
1
vote
0answers
24 views

Loading template parts conditionally in Customizer

Here are my issues: I have layout options in customizer for full width or two columns. For fullwidth sidebar will not be loaded. The problem is if the setting is currently on full width when ...
0
votes
1answer
51 views

Check if CTP category taxonomy is set in shortcode

I have created a custom post type with the ability to add categories (taxonomy). Taxonomy function create_cat_tax() { register_taxonomy( 'cpt_cats', 'cpt_faqs', ...
0
votes
0answers
28 views

Checking supported arguments in theme features ( current_theme_supports )?

I think I wan't to use get_theme_support since it returns an array of arguements where current_theme_supports doesn't (as far as I know). For example, here's a theme support in genesis for adding ...
0
votes
1answer
68 views

Check if the current shortcode is being used in a widget

How can I check if the current shortcode is being used in a widget? I need to disable some shortcode options that are not allowed in a widget. Someone know how?
0
votes
1answer
56 views

Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu

The Challenge I have been trying to write a filter that applies (prepends a string) to (a) post titles of a certain post type and (b) to that same post type WordPress admin backend for use by an auto ...
0
votes
0answers
33 views

TinyMCE custom button on post-new.php screen

Iam building a small slideshow plugin. For this I registered a new post-type which is called "prfx_slide". And also set-up a shortcode function so that I can use the slider as a shortcode. With the ...
0
votes
2answers
30 views

Show all tags NOT applied to post

I'm working on a checklist within wordpress – I have a huge list of posts and I want to tag them with checks that have been done for the post. However, I want to display all the tags not applied on ...
0
votes
3answers
40 views

How to apply a function if conditon a & b [closed]

I want to apply a function if post is updated and if post author id is not 1. For this i tried many functions like <?php if (get_the_modified_time() != get_the_time()) && ( $author_id != 1 ...
0
votes
1answer
36 views

How to add conditionals for IE browsers between certain versions?

I know that wp_script_add_data and wp_style_add_data are the correct functions for adding IE conditionals. For example, this: wp_script_add_data( 'foo', 'conditional', 'lt IE 9' ); Would get you ...
0
votes
1answer
40 views

Conditional tags returning different results for different areas on a page?

I have a custom template. I want to output some JavaScript based on the type of page I am on. My current setup includes a static front page, with a template assigned it to it. This template is also a ...
0
votes
2answers
37 views

is_singular() equivalent for backend

I use the conditonal function is_singular($my_post_type) inside my plugin and it is very convenient. The problem is that is doesn't work backend. Is there an alternative that works frontend & ...
1
vote
3answers
53 views

If (category / tag checked) then (display header2php)

I have 3 headers (header.php, header2.php, and header3.php). I want to always display header.php at the top. Below header.php, I want a second header to display depending on what category the post is. ...
0
votes
0answers
27 views

if IS and IS NOT statement not having desired effect on custom taxonomy

I'm not a developer, I'm essentially learning as I go. I'm trying the following statement, and it's executing but not having any effect: function share_discount( $download_id ) { if ( ...
1
vote
1answer
22 views

Conditional tags or Multiple files

If the official themes and Underscores are some sort of a guide, one would notice that multiple files with little differences are preferred over conditional tags (archive.php, search.php, ...
0
votes
2answers
75 views

Inserting HTML to close and open divs in WP_Query loops

The output I am trying to achieve is this: <div class="row"> <div class="small-1 large-4 columns"><a href="some link"><img src="some image"></a></div> <div ...
0
votes
2answers
18 views

page single conditional

Using underscores, I made a lot of small, simple custome themes. I was more interested in CSS and simple layout modifications, but I'm not used to vanilla PHP. What I need I think is a simple code, ...
0
votes
1answer
23 views

Manipulating cookie on specific taxonomy archive page

I have this code to set cookie when user on the taxonomy archive page called 'term-country' if (is_tax('term-country')) add_action('init', 'my_setcookie'); // my_setcookie() set the cookie on the ...
0
votes
1answer
21 views

Blog Posts vs Static Page (conditional statements)

I want to determine when it's the following page: Front page displays the Blog page Front page displays the Blog page + subpages: /page/2/... Front page as static page Blog page as static page Blog ...
0
votes
1answer
40 views

Three variables on conditional tags

I'm trying to return $ad_code if three variables are present, but it doesn't allow the third variable I'm trying to add. I want to exclude a category. I am trying to use (in accordance with ...
0
votes
1answer
24 views

Conditional Tags for specific category of custom posts

How would I show a sidebar only if the post (a custom post type) belongs to a specific category of that custom post type? I was looking for something like: if ( is_singular( 'my_custom_post_type' ) ...
2
votes
2answers
559 views

Current post's author name in the author meta tag

I am trying to add the current post's author as the content for the meta author tag. I wrapped this particular meta in an is_single condition and then tried: <meta name="author" content="<?php ...
0
votes
1answer
46 views

Conditional Tags - Multiple Categories

I need to have all News posts show a category header (while not showing the post title). The following piece of code seems to do the job: if($category[0]->name == 'News'){?> <script> ...
0
votes
1answer
70 views

how to display featured image for single post for a specific category

I used this function to display featured images on top of single posts and it works great. But I need it to only apply to the category 'team' with an ID of 31. I have tried every possible combination ...
0
votes
0answers
32 views

Adding condition to a Form plugin

I am trying to figure out how to get my Form plugin which I had it customized to do a certain thing for a specific form (lets sat form #100) to not to do the same on other forms that are being ...
0
votes
0answers
56 views

Can you check if a post WYSIWYG field has an image in it?

I'm using Advanced Custom Fields and a WYSIWYG field type. Can you determine via php if that field has an image in the content OR is there a better was to evaluate this. For example, if I upload an ...
1
vote
1answer
162 views

How to check if a post “does not have term” in conditional statement?

We know that we can check if the particular post has a term by using this code: has_term('term', 'taxonomy', $post->ID )) { I was wondering if there is a code to check if a particular post does ...
0
votes
1answer
25 views

Is it possible to If statement “article already appears on page”?

Best is an example: Front page. I want to have a featured section at top. If A Science post is in my Featured, I don't want it to also show in my Science section of the same page. Can I If-Statement ...
0
votes
1answer
41 views

How to use the conditional homepage tag

I'm trying to display a video in the header of the homepage only but struggling to figure out the correct code. This is the code for the video tag, which seems to be working fine if ( is_home() ) { ...
0
votes
1answer
50 views

Search Page: activate html code if the tag is on the page

this is the first time that I write here and my English is not very good, I will try to explain as best as possible. I want to activate some html text if in the result page, the results, has a ...
-1
votes
1answer
53 views

Conditional statement checking two conditions for CPT and Custom Taxonomy [closed]

I am trying to write a conditional statement which checks if the single custom post type also has a custom taxonomy term associated with it. My code is: if (is_singular('my_cpt')) && ...
0
votes
0answers
32 views

customizing wordpress theme slider with switch statement

i am working on an assignment for wordpress , i need help in following matter, im using wordpress today news theme, the link of my current work ca.unitysofts.com in upper three slider , while ...
-2
votes
1answer
104 views

Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]

Having issues with a line of code that's in an if/else statement. It's PHP so I should be using php echo to make it work but I can't seem to get the coding correct. Here's what it should be ...
0
votes
1answer
153 views

Google Analytics tracking code on just one page?

Having an issue where I have a client who wants his Google Analytics code on just one page. I'm using the following is_page code but in the footer.php of my child theme, but it's not appearing on the ...
0
votes
1answer
30 views

showing tag beside catagory

thanks for your guidance, here is one last but not least thing for me to learn, i am using Today news wordpress theme, since with your help i have moved my process from category to tag based ...
0
votes
1answer
42 views

Include Buddypress & bbPress styles/scripts conditionally

I'm working on a custom theme that uses Buddypress and bbPress to add social network functionality. I've noticed that both plugins css and js (many files) are loaded on every page, even though none of ...
0
votes
1answer
3k views

How to get image title/alt attribute?

in my wite theme, there is no alt tag configured in home slider post, i have added alt text with image from media upload. i have added below code to add / retrieve alt tag. but it display blank ...
0
votes
1answer
53 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
1answer
79 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
103 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 ...
2
votes
1answer
119 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
64 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
192 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
920 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
81 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
256 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 ...