The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
316 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
900 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
530 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
141 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
2k 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
629 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
118 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
1answer
180 views

Do not run this code on posts with a specific tag!

This is sort of complicated. I am looking for some php help related to WordPress blog. The basic requirement is that some HTML code (ad code) is not supposed to run on posts with a specific tag. ...
0
votes
2answers
335 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"> ...
26
votes
6answers
68k 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 ...
6
votes
2answers
4k 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
697 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
622 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
619 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 ...
1
vote
1answer
162 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 ...
2
votes
2answers
2k 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
528 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
329 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?
9
votes
3answers
8k 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
91 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 ...