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

learn more… | top users | synonyms

0
votes
0answers
22 views

Get posts from other blog with common tags? [on hold]

i want to get 5 posts from an other blog with common tags with current post and show it on my website.
2
votes
1answer
475 views

Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress

Can anyone tell me how to auto fill/add same image title in title, caption, alt text and description while uploading any image in my WordPress Posts.
0
votes
0answers
18 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 ...
10
votes
2answers
4k views

Toggle admin metabox based upon chosen page template

I'd like to have a custom field interface show up only when a certain template is assigned to a particular WordPress page. Any ideas?
0
votes
4answers
412 views

Function to echo (or display?) wordpress tags in the head section

I can't figure this out but I'm trying to echo the post Tags of the post in the <head> section. This code resides in the <head> section of the site. Basically I want the post tags to ...
0
votes
2answers
2k views

Conditional tags issue for multiple is_page() conditions in sidebar.php

I've been pulling my hair out today trying to get this right. Basically I have a sidebar, which makes requests to individual files (such as sidebar-home.php, sidebar-residential.php) and different ...
0
votes
1answer
21 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
22 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
38 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
11 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
28 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
12 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 ...
0
votes
1answer
31 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 ...
-2
votes
1answer
27 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
27 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 ...
1
vote
1answer
1k views

using get_the_category to get all post categories except one

foreach((get_the_category()) as $cat) { if (!($cat->cat_name=='Featured')) echo $cat->cat_name . ' '; } this is what has been recommended in the forums but its not working for me. I need to ...
0
votes
1answer
36 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
30 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
91 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
17 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 ...
1
vote
1answer
269 views

Identify a Woocommerce page by Wordpress conditional tags

we have a website running on WPMU, and the main site is using Woo-commerce and the sub sites doesn't use that. I use conditional statement in my meta title with following code: <title> <?php ...
0
votes
1answer
39 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
40 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
36 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
69 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
93 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
54 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
87 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
72 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
22 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
89 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
40 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
49 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
97 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
35 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
2answers
126 views

Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)

I am using this to load css styles in the admin area (for any user who is not an administrator): function wpse_admin_styles() { if ( !current_user_can( 'manage_options' ) ) { echo ...
0
votes
1answer
156 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
231 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
30 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
37 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 ...
2
votes
2answers
3k views

How To Remove The Author(s) From Certain Posts

There are certain posts on the website I'm developing, that don't need the author(s) by-line. (such as press releases) Is there any method, that allows me to remove the author (and co-authors) for ...
0
votes
2answers
49 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
505 views

If tag exists, then echo once

I have the following code and I'm trying to check to see if a specific tag exists, and if so, I need to echo it once. The problem is when the tag exists in multiple places, it echos multiple times. ...
0
votes
1answer
21 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( ...
1
vote
1answer
2k views

Is_search not working on search results page

I have an extra submenu with this code in the sidebar: if(is_404() || is_search()) : echo 'should be empty'; else : if($post->post_parent == '68') $children = ...
0
votes
1answer
67 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
64 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
51 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
98 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
15 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 ...