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

learn more… | top users | synonyms

1
vote
1answer
59 views

Custom Post Conditional for Parent & Child Single.php?

Following on from previous question but needs to be more specific so thought a new topic would be best... Conditional tag for custom post parent and children on their corresponding single.php, ...
0
votes
1answer
37 views

Hide page header on both index and author pages [closed]

I'm using the Roots theme which is tricky to start with. I'm trying to hide the page headers from both index and author pages. I got to do it on index by using the following code: <?php ...
0
votes
0answers
21 views

Conditional to use 'full' image size with animated GIFs

I am using ACF and pulling images into my category archives via ‘wp_get_attachment_image_src’ like this: <?php $image = wp_get_attachment_image_src(get_field('image'), ‘grid’); ?> <img ...
0
votes
1answer
31 views

How to check if the current page's parent is one of 2 different ID's

I'm using this little snippet right now to check if the current page is the child of a particular page; $studies_parent = 5860; if ($studies_parent == $post->post_parent) { Which is working ...
0
votes
1answer
359 views

what is the action hook code to supporting product category condition in single product page of woocommerce?

I want to display product attributes of 2 different product category with the help of conditional tags. But the condition was not working This is the condition that i given ...
0
votes
1answer
62 views

Conditional Tags If Custom Post Parent & Child?

Check on the single-artists.php whether we are viewing the parent or child of the said custom post? Tried this but always shows the top child content, rather then showing the two different area ...
1
vote
1answer
177 views

is_page not working when loading javascript with add_action in functions.php

This code is working in my functions.php and it's loaded properly: add_action('wp_enqueue_scripts', 'js_custom', 50); function js_custom() { wp_register_script( 'js_custom', ...
0
votes
0answers
15 views

Worth enqueue_scripts for mobile via is_mobile? [duplicate]

Is it worth loading the JS for i dunno turning on a responsive menu via the is_mobile conditional? As technically its only going to be used on a mobile device, would it be good practice or improve ...
0
votes
1answer
221 views

do code if current url = value

The Google Content Experiments installation is not working for me. I add the code in the header, but nothing is output. So, I've added the Google Analytics experiment code manually into the header. ...
1
vote
0answers
177 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
2answers
140 views

Checking if a woocommerce attribute is set

I'm trying to figure out how I can check if a custom attribute is set in woocommerce on a product. As It generates an error if that particular attribute isn't set. Here is my code that pulls in the ...
0
votes
2answers
40 views

Need help with else if statement

I am trying to set up my blog so that there are different colors for 2 different categories, however, if there is a post that is tagged with neither of these 2 categories I want it to default to ...
0
votes
3answers
254 views

Is_single() conditional tag returns null in query

Trying to figure out why this won't work for me. I'm simply trying to run a loop of all posts and pages, and tag them as post and page in a array. But the is_single() conditional is not working, all ...
0
votes
1answer
72 views

Redirect to URL if x number of days passed

Let's say I have this URL: www.example.com/myCPT/post, here I want to check if 3 days has passed since the post was created to redirect to www.example.com/myCPT/post/stats. In this 3 days time frame ...
-1
votes
1answer
547 views

Move Genesis Single Page/Single Post Title

Im not sure on how to do this .. But what i want to do is . Move the Page/Single Post Page title. Remove the title for Homepage only. Keep the titles of my posts. (Loop page) or (Blog Page) ...
-1
votes
1answer
52 views

strange conditional tag behaviour [duplicate]

I have this code inside my comments.php : <?php // If CPT and not logged in, display a message: if ( 'CPT' == get_post_type() && ! is_user_logged_in() ) { echo '<p ...
-1
votes
2answers
71 views

changing default comment form arguments [duplicate]

I want to change the default comment form title_reply, label_submit ... just on my CPT without affecting the default comment form but I can't get it to work without affecting the default ones. First ...
1
vote
1answer
76 views

disable comments if array exists

This is the code which is registering the function for rewrite_endpoints(): function wpa121567_rewrite_endpoints(){ add_rewrite_endpoint( 'comments', EP_PERMALINK ); add_rewrite_endpoint( 'stats', ...
0
votes
1answer
79 views

How to show only the most recent post on my custom post type archive?

I have registered a custom post type and inside my archive-myCPT.php I want to retrieve just the current published post. Here is a relevant snippet from my archive-myCPT.php: <?php if( ...
0
votes
1answer
117 views

custom post type upcoming post and past post

I want to retrieve inside my archive-CPT.php most recent upcoming post ( post with status of future) and past post (oldest published post). This is how my archive-CPT.php is looking like: <?php ...
0
votes
0answers
64 views

restrict access to specific urls on a specific period of time

I have a countdown timer plugin which is set do redirect the user to a specific permalink after the time is elapsed. I've added a countdown timer here : mywebsite.com/mypost which is set to 3 days ...
0
votes
1answer
66 views

If Parent or Current Page Is, Then Statement?

I need a conditional statement which checks to see if the page the user is currently on is a child of a specific parent page or that parent page itself, and if so, display a link. How do I achieve ...
0
votes
0answers
68 views

Detect Page Template inside Loop possible?

I'm a bit stuck with my actual theme development. I'm using different Blog Templates to choose from. Now each of those Blog Page Templates has a custom loop to pull the posts. Inside that loop I use ...
0
votes
0answers
45 views

Change conditional tag in wordpress without editing the core files

In wp-admin/includes/class-wp-posts-list-table.php lines 59-69: if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { $exclude_states = get_post_stati( ...
0
votes
1answer
87 views

comments hooks on custom post type

First, this is what I want to achieve: I want to add a comments hook on a CPT which is asking users to be registered and logged in to be able to post a comment. And after the user is logged in to ...
0
votes
1answer
344 views

Show a 404 error page if Public query variable's value doesn't exist?

Public query vars are those available and usable via a direct URL query. On my site, I've created some custom URLs with their own query variables like so: ...
1
vote
2answers
107 views

is_archive() doesn't work on public query var archive pages?

Public query vars are those available and usable via a direct URL query. E.g. example.net/?category_name=tech&tag=gadgets But doesn't example.net/?category_name=tech&tag=gadgets show ...
0
votes
1answer
137 views

remove child post from custom post type archive

I have a custom post type and a page like this for displaying the posts inside : archive-(myCPT).php I've created 2 posts, and one of them is the child. How can I display just the parent page inside ...
0
votes
1answer
274 views

Remove CSS & JS files from Wordpress Main Page For Increase Pagespeed?

With the reference of http://stackoverflow.com/questions/12463304/wordpress-load-plugin-css-js-in-functions-php-w-conditional-tags answered by @maiorano84 i am using cforms, FancyBox, WP Page ...
0
votes
1answer
54 views

how to show this part only in the single post page?

I have this part in my index-meta.php file : <ul> <li class="Source"><a>source:</a></li> ...
1
vote
1answer
91 views

custom comments on specific post type

I have a custom post type called debate and I want to create some custom fields just on this post type. So, I have this code: function debate_comment_fields( $fields ) { if( is_singular( ...
0
votes
3answers
192 views

Conditional Statements

I have created Custom Post Type called - listing Also created custom taxonomy - listingcategories In listing categories, i have created two categories music 2. features Now i want to create a ...
0
votes
3answers
103 views

Conditional tags not working

I'd like to display some CSS only for this page. In the theme's header.php, I have tried both: <?php if(is_page('events')) { ?> <style> #main { background-image: none; } ...
0
votes
0answers
131 views

is_page() is not executed

I am making infinite scroll page. I created a page template where posts of certain category are loaded. Everything works fine with a single page and single category. But I have three pages with this ...
0
votes
1answer
634 views

is_active_sidebar() Always Returns False

I've never gotten is_active_sidebar() to work, no matter if there's widgets in the sidebar or not I always get false returned. Currently I'm creating a sidebar for each top level page: ...
0
votes
2answers
59 views

Conditional Tag for sub cagtegories?

We have is_category() for categories, however I m not getting a conditional tags for subcategories, I want to enqueue script only on subcategories but on the parent. So lets say I have a parent ...
0
votes
4answers
136 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
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
1answer
732 views

is_home() not working in functions.php file

I'm using woo themes and trying to use some woo hooks to hook into the index.php file from my child theme. I'm using the following code: function content_woo_main_before() { if (is_home() || ...
0
votes
3answers
220 views

Only show content if current page is NOT one of 2 page templates [closed]

I've been using this if conditional statement to only show content if the current page is NOT using a certain page template; if (! is_page_template('template-custom.php')) { <!-- show some ...
0
votes
1answer
577 views

Limit Contact Form 7 hook to specific form [closed]

I'm using a Contact Form 7 filter to take action after the email is sent. How can I limit this action to only one form? There are multiple forms on different pages, and I don't want this action to run ...
0
votes
0answers
56 views

Conditional before_widget and after_widget

Is it possible to use a custom before_widget and/or after_widget value for certain widgets? For example, I'd like to add a opening <div> tag before the first and closing </div> tag after ...
0
votes
0answers
328 views

is_home() and is_front_page() not working in sidebar

I'm trying to display a custom widget in the sidebar of my homepage (which is a static front page defined in Settings > Reading). Here is the relevant part of my sidebar.php: if ( is_front_page() ...
0
votes
1answer
91 views

Removing template part when not on homepage if / else

Thank you in advance for any help! What I am trying to do is remove a template part from my home page after the user clicks on the pagination links from the posts, right now my template part serves as ...
1
vote
1answer
114 views

Adding conditional content to single post-type template

I have a new custom post type set up that will be where an online copy of our email newsletter lives, like any web-based archive of newsletters. I am trying to create a conditional statement to add ...
0
votes
1answer
32 views

Show content if page is a grandchild of top level page

I'm looking to show a certain block of content if the current page is a grandchild of a top level page. This is my current page heirarchy; - Top Level Page - Child Page - Grandchild Page ...
0
votes
2answers
352 views

Loading Scripts For Specific Template

I'm attempting to load a couple of scripts based on the template in use. However, the is_page_template is not activating. From my functions.php in the child theme I have: function sectionDescription ...
0
votes
3answers
257 views

Get template part based on custom taxonomy term

I have a custom post type and I'm trying to call up different variations of the navigation based on the custom taxonomy slug. I've done this fairly easily with normal posts, like so: <?php ...
0
votes
2answers
338 views

If is_single in functions.php

I want the remove wpautop filter working only on posts from my blog. Because at some pages i need the autop, and at some pages i need it to not be there. I use the following rule and it is in my ...