The conditional-content tag has no wiki summary.
1
vote
2answers
410 views
wordpress is_page() problem
I want to load a .js file only on a specific page in Wordpress 3.1.2
So I use in functions.php
function my_init_method() {
if (is_page('myinfopage')){
echo "yeeessssssss";
...
0
votes
1answer
185 views
Exclude a category from a query that includes its parent category
I am trying to use ids to control the structure of the output of my categories. I need to exclude a category that is part of the parent category that is being queried.
What I am trying is :
...
1
vote
1answer
512 views
functions.php conditional tag - only show in single.php?
//Geo Map
add_action( 'woo_post_inside_after', 'my_geo_mashup' );
function my_geo_mashup() {
global $post;
if ( in_category('listings') ) {
echo GeoMashup::map();
}
}
Works to ...
2
votes
1answer
564 views
If function exists, and array is met, echo function?
I have a function like the following:
<?php echo my_custom_function( array( 'category_url'=>'My Special Category' ) ); ?>
It pulls data from the "My Special Category" and displays it. I ...
2
votes
7answers
5k views
Display navigation menu item conditionally based on user capabilities
I have one "branch" of my main site's navigation tree that should only be accessible to a set of registered, logged-in users. I understand how to query a user's role and capabilities. This question is ...
1
vote
2answers
117 views
can't use the page_test method to check pagination
I've tried to follow the example for Testing for paginated Pages but i don't know why it isn't working. i put it in the single.php file for post detection. i don't know why the page_test is broken. ...
2
votes
1answer
510 views
Conditional tag affecting taxonomy term and its children?
I am wondering how can I write a conditional tag that affects a custom taxonomy slug and its children?
Found this in Wordpress Codex:
is_tax( 'flavor', 'mild')
When the archive page for the ...
2
votes
1answer
2k views
How can I determine if a post has an image attachment?
As far as I know, there's not a simple function that will return true if a post has an attachment. With that in mind, what's the best way to determine if a post has an attachment (or even better, has ...
0
votes
2answers
333 views
How do I test whether [gallery] is empty?
How do I test whether there are any images attached to a post?
I'm using the gallery shortcode, but I want to put it in a conditional so the surrounding styling isn't displayed if the gallery is ...
0
votes
2answers
264 views
Conditional statement not working in function
Why doesnt this work ? I am trying to selectively load scripts but the second if statement is not loading them where it should.
function my_init() {
if (!is_admin()) {
...
1
vote
2answers
649 views
Function like in_category for custom taxonomies
I'm trying to display different content depending on the taxonomy that was been selected. For example I have a taxonomy named Type. Inside that taxonomy I have several different children, one is ...
3
votes
2answers
401 views
how to test for attached image
I am trying to find out whether or not a post has images. If it does, I then want to know if a featured image was specified for the thumbnail - if not, the get_thumb() function will assign an image ...
0
votes
1answer
117 views
Return count for characters in the comment and perform action based on the length
I am calling recent comments into my template with
$comment->post_title
the variable length is specified like this :
SUBSTRING(comment_content,1,180)
how could I write a conditional ...
2
votes
2answers
1k views
Loading Scripts on Specific Pages
In child theme I created a functions.php file that loads scripts and style files, the code is below.
The section that loads libraries and scripts to all pages other than admin, in other words the ...
2
votes
1answer
520 views
How to make gravatar.com avatars conditional?
Problem: I am using custom avatars for registered users and my own locally-hosted image as the default gravatar. I want to stop WordPress making HTTP requests to check for gravatar.com images on every ...
2
votes
1answer
110 views
Search result conditonal tag
Is there a conditional tag (or a similar concept) that can tell me wether the search returned posts or not?
0
votes
2answers
228 views
Return function only on certain pages
I'd like this function to only return on certain pages. How might i do that?
// Retreats Accordion
function retreats_accordion() {
?>
<!-- accordion root -->
<div id="accordion">
...
12
votes
5answers
23k 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 ...
4
votes
1answer
3k views
how to create a conditional content_width for a wordpress theme?
I'm trying to create a conditional statement for the content width in the functions.php of my theme. So some categories will have a content_width of 580, some will have 900. This will make the oEmbed ...
3
votes
1answer
609 views
Loading Javascript Only When Specific Content Existing in a Post?
I'm trying to add Javascript for my "PrettyPhoto" plugin to pages only when their content contains rel='prettyPhoto'. This looks very simple to me but all solutions I've found on the internet doesn't ...
1
vote
3answers
583 views
How to Add Javascript Only When a Function Exists?
I have a few function. For both of them need javascript code. I need to add javascript code in header only when function is active. At this time I have all my javascript code in header for all my ...
1
vote
1answer
551 views
Can I create a loop with multiple post types and specify different $args for each post type?
I'd like to create a custom loop that includes all Post types: Post and Video. Then I'd like to specify to show all posts of the post type Video, but only show posts that are in the category ...
0
votes
1answer
150 views
How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?
Often times, a custom theme for Wordpress will require a dynamic content that reflects a relationship to a top level page of a site.
Is there a Conditional Tag that will check if the current page is ...
1
vote
2answers
640 views
How to tell if the user is an admin?
I need to show some info only to admins visiting a page, so I need a conditional tag to identify them. So far I have found:
<?php if ( current_user_can('manage_options') ): ?>
is this the ...
1
vote
1answer
439 views
Conditional PNG Overlay in Custom Post Type Loop Depending on Post Type
I have a loop pulling in two different custom post types. I have that loop showing the thumbnails of posts. Each post type used to have its own seperate loop and I had set up some png overlays to ...
2
votes
1answer
1k views
Checking if a Page has an Associated Term?
I am looking for a way to do some conditional logic on terms associated with a post.
Essentially I created my own custom taxonomy for "age groups" and have created three terms for them. Kids, Teens, ...
0
votes
1answer
239 views
Target pages using a specific page template
I need to target all pages using a specific page template with a conditional tag (like is_page()). Anyone done something like that before?
7
votes
3answers
5k views
Loading scripts only if a particular shortcode or widget is present
I needed a way to filter a page/posts content before it was loaded so I could add scripts to the header if a specific shortcode was present. After much searching I came across this on ...
3
votes
3answers
83 views
How do I place content on archive pages but not on main page?
I would like to place content in a sidebar of my blog articles when they are viewed in the archive, but not show this content when the blog articles are shown on the main page of my site.
Can this ...