0
votes
1answer
266 views

is_singular() not working if called via callback function of admin-ajax.php

In my single.php I've some code like this ... if(is_singular('post')) { echo 'Blog'; } else { echo 'CPT'; } If I approach single.php from blog or CPT index page by using the_permalink(), ...
1
vote
1answer
175 views

Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms

I am using Isotope to filter posts on the fly from my archive pages. I have a Custom Post Type called "art". On the sidebar, I've created links to yearly archives on my sidebar, i.e. 2014, 2013, ...
0
votes
0answers
65 views

Diffrent search templates for different post types

I have a site with diffrent post types. Two of them are the 'post' post type and the other one is 'charity', for both pages I have an index, the normal index.php and a diffrent page template for ...
1
vote
1answer
63 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
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 ...
0
votes
1answer
73 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
585 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
72 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 ...
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
120 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
1answer
88 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
148 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 ...
1
vote
1answer
93 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
205 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
269 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
1answer
445 views

If custom taxonomy else conditional [closed]

I have a menu that I only want to show on certain pages using the following code: <?php if ( is_front_page() || is_archive() || is_404() ) { } else { if ( function_exists('has_parent') ) { ...
0
votes
1answer
314 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
0answers
97 views

Custom Post Query Combined with Conditional Tags

Is it possible to combine displaying a list of custom post types on a single page depending on conditional tags? Below is what I have so far, basically if there are 4 posts or less show the posts, if ...
0
votes
2answers
351 views

Show specific content on parent custom post type and all children

I have 5 main posts within a custom post type. Some of these posts will have children. I have content that should only be displayed on the parent post and all children of that post. What's the best ...
0
votes
2answers
321 views

Excluding custom post types

I'm attempting to develop an is_blog() function which returns true if the current view is a single post, blog home, or post archive. I have successfully excluded pages and attachments. My current code ...
0
votes
1answer
104 views

Conditional for a Single Post That Belongs to a Category?

I have categories like gaming and movies on my website and when a user visits any of these categories the content in the sidebar is displayed depending on the category they are in. So gaming content ...
0
votes
1answer
224 views

Exclude custom function content from certain pages

I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is ...
0
votes
2answers
821 views

if custom posts type exists and there are posts load script

I have registered a custom post type 'featured_post'. I am looking for a way to test if the blog home page has any 'featured_post' posts on it and if it has load a javascript file. The ...
0
votes
1answer
211 views

How to check if post/page or taxonomy post is published by admin

Example :- 10 users and 2 admin in a site. If the post is published by admins than <?php ?????() { ?> <!-- do this --> <?php } else { ?> <!-- do this if posted by ...
1
vote
1answer
3k views

If on term-page -> get the current term?

I'm trying to write a kind of "breadcrumb" function in my "functions.php" I'd like to query if I'm on a term-page and if so I want to print the current term I'm in. By "term-page" I mean the ...
0
votes
1answer
663 views

Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed

I have many custom post types, including some introduced by plugin such as bbPress or WooCommerce. My standard stylesheet is growing large, so I thought to split it into multiple stylesheets ...
0
votes
1answer
279 views

Hide Slider on Post Type Page

If users enter a code on the homepage and that code is valid they will be sent to a post type page where a profile is shown. The issue is that somehow the homepage slider is shown on that profile page ...
1
vote
2answers
386 views

Register widget only page is a singular of custom post type

I've made a custom post type, with a few accompanying widgets, and I was wondering if it is possible to show (some of) these widgets only if you're on a specific page. Currently I've got function ...
0
votes
1answer
316 views

TinyMCE Buttons on Certain Post Type

I'm creating a plugin that will allow users to create custom post types on the fly. On the new post types, I want a custom Button to show In the TinyMCE. Each of the post types has a unique ...
1
vote
1answer
3k views

Conditional for single-{post-type}.php

Please help with this code for custom post type "video": If is single-video.php page { list custom-taxonomy of video. Example actors } Else { do nothing } I´m tried with is_single, ...
1
vote
1answer
46 views

Is there a conditional tag to determine whether the post is _any_ custom post type?

We know you can do if ( is_singular( 'my-cpt' ) ) to test for a specific custom post type, but what about doing one thing if the post is a built-in post type, and another if it is not? Is it enough ...
1
vote
2answers
1k views

functions.php conditional tag only for custom post type

I'm using gpp slideshow, which overwrites wordpress's default gallery display. I only want to use it on my custom post type, "listings" - how would I reference it to only replace wordpress's default ...
1
vote
2answers
1k views

Conditional Query of Custom Post Type and custom taxonomy

I am working on a project that has a custom post type called 'Experience Statement' Custom Taxonomy attached to that post type called 'Expertise' 6 different terms for the custom taxonomy: Coastal, ...
22
votes
6answers
60k views

If is custom post type

I am looking for a way to test if a post is a custom post type. For example, in say the sidebar I can put code like this: if( is_single()) { //code here } I want code were I could do ...