The tag has no wiki summary.

learn more… | top users | synonyms

-2
votes
1answer
143 views

Weird html output of single_cat_title - is not inside of the html element?

I'm displaying a single "featured" post at the top of the blog index page, and category pages. I'm using this conditional to display the category name of the category page if it is a category page, ...
0
votes
2answers
106 views

Check IF single OR multiple custom data has been entered

I'm building a single template right now for a custom post type. I'm wondering if there is a way to check if either at least one or multiple of the custom values has been entered so I can display the ...
0
votes
3answers
99 views

How do I add a nested conditional within an echo - to use a default image if there isn't one in the post?

I'm trying to add a conditional that will display a default image if the "image" field isn't populated... here's what I'm trying to work with: $args = array( 'posts_per_page' => 3, ...
0
votes
1answer
666 views

Show content after the first and second paragraph

The function below is used to show certain content after the first paragraph. I would like to show 'content X' after the 1st paragraph and 'content Y' after 2nd paragraph. <?php $paragraphAfter= ...
1
vote
2answers
239 views

Conditionally load CSS/JS/PHP in wp-admin if using a mobile device

I'm looking for a way to conditionally load different scripts if the user is accessing the admin area from a mobile device. In my case I'm looking to restrict the user to just be able to make new ...
0
votes
1answer
99 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 ...
1
vote
2answers
432 views

Reordering Buddy Press profile navigation

I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use: ...
0
votes
1answer
179 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 ...
2
votes
1answer
178 views

Conditional Ajax inclusion

I have a custom interface that uses 30+ ajax files while running... some files are only used in category.php while othere's are only used in page.php... i include the ajax loader php files in my ...
0
votes
2answers
97 views

How to use “Cases” instead of “IFs” for conditional logic

Recently I've been developing sites for WordPress that are both increasingly complex but also have much higher rates of traffic. I remember when I was learning the ropes from another about PHP, that ...
0
votes
1answer
250 views

Limit page template choice by page title or ID?

I'm developing a multisite and creating my own themes for it. All the themes will feature some standard pre-defined pages eg. homepage, about, blog, contact us etc. Each page will also have a number ...
0
votes
1answer
114 views

Change a url / link if a user is logged in?

I'm working on some themes for a multisite and would like to modify the code below. It relates to a special div that will display an image or logo that users upload. Normally the logo links to the ...
1
vote
2answers
436 views

Add default content to posts in a specific category?

Update / Question clarification: How could you modify the following code from this thread: Force category choice before creating new post? which offers a drop-down menu to choose a category BEFORE ...
0
votes
1answer
111 views

Why is the `if else` not working?

I have this on my header.php. It checks whether the page is on homepage/frontpage, is on category/children of/has the category of "gamenews", or is on category/children of/has the category of ...
0
votes
1answer
47 views

include <p> content within conditional statement?

I have a gallery page wherein there are multiple individual galleries/sub-pages. I handle this function by using- <?php if( is_page( 39 ) ) { echo do_shortcode('[nggallery id=1]'); ...
0
votes
1answer
36 views

Specific coditional usage [closed]

I have some trouble making work a conditional inside a Function. check this out: I'm using this function: function get_spec_1(){ $desc1 = get_post_meta( get_the_ID(), 'eco_mb_tp_1', true!= "" ); ...
2
votes
2answers
3k views

wp enqueue style on specific page templates

I am in the process of a theme, I would like to add landing pages using page-templates. I cannot find anywhere that shows how to enqueue style or js for specific page templates. Any suggestions. Ex. ...
1
vote
2answers
93 views

Determine page content based on page parent

How can I display a gallery shortcode for pages who are children of the page with an ID of 9, and the regular content for pages who aren't? This is what I've tried so far, but it's not working: ...
0
votes
2answers
46 views

Looks like this if condition is not working [closed]

I want a query to be executed IF the following condition is true... but looks like the query is executed anyways. if($post->post_parent = '302'){ // Query goes here } Is this query fine?? I want ...
0
votes
1answer
111 views

If else with shortcodes

I only want one of these shortcodes to display if the custom field value is true. I'm not understanding the logic to do this. So basically, if there is a twitch video and a own3d video I only want the ...
3
votes
2answers
1k views

How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?

I would like to create a condition that checks to see if a post has a thumbail and if it does display it, otherwise display the first image in a post. I tried something like this in my loop.php but ...
0
votes
2answers
956 views

How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?

I would like to be able to conditionally hide the author's name on the Single.php if the Category name is equal to "News" and otherwise if the category is something else hide it. How do I go about ...
1
vote
5answers
303 views

meta content on required pages

I need to post extra information on programs pages, so i have decided to use wordpress metabox but its showing on all pages. So is there any condition check so it could put meta box on those sub pages ...
0
votes
1answer
31 views

Template tag for /page/# structure

I'm trying to find a template page (or conditional statement) that will target: http://url.com but not http://url.com/page/2/ home.php and front-page.php seem to target both. The front ...
1
vote
1answer
67 views

Check to see if specific loop has less than certain amount of posts

I'm looking for a way to check how many posts are returned by a specific loop. So if I have a loop like this.. <?php $featured_post_id = get_the_ID(); global $post; $args = array('cat' => ...
5
votes
3answers
998 views

Check if first paragraph is an image, then show custom code right after it?

I would like to add some code in functions.php that does this: If the first paragraph contains an image, show my custom code right AFTER it. For example: <div class="entry-content"> ...
1
vote
2answers
310 views

Plugin Code ONLY on Post Edit Page

I have a wordpress plugin that is interfering with the function of another plugin. But, I believe the interference only occurs on the admin side. I've found the lines within the code that are ...
0
votes
2answers
467 views

Conditionals if tags exist?

I have the following code to display tagged articles with the same name as the page title, but I only want the to appear if the tag exists, otherwise it just says 'Related Articles' with no content. ...
0
votes
1answer
220 views

Proper syntax for simple conditional bloginfo language

I need to do something like this: <?php $bloginfo = get_bloginfo( 'language' ); if($bloginfo->en-US){ the_time('jS F Y'); }else{ the_time('d/m/Y'); }; ?> I cant find the proper ...
0
votes
1answer
130 views

Create citation and url in post using 3 custom fields with conditions for each field… So close!

I am creating a new baseball blog. When submitting a post, I want Authors to cite their source for a news type of post. I have created a custom meta box with three custom fields: Source title, the ...
0
votes
2answers
393 views

Conditional sidebar menu

I've created a menu for each section of the site, and I'd like the sidebar to only show the relevant menu to pages in a section, so the 'About' page and its children receive the about menu and the ...
0
votes
2answers
325 views

Loop to pull content from parent element in custom post type [duplicate]

I created a hierarchical custom post type called "films." It is hierarchical so it can have children elements. I am using a conditional statement in my single-films.php to show different content for ...
0
votes
2answers
206 views

Condition display metabox in case the post is saved

I need to register a metabox in my WordPress custom post, but only in case the post is permanent saved in database. What I mean, when the user click on "Add new" I don't want to display the metabox. ...
0
votes
1answer
187 views

How do I display something on a particular category page?

How would I display HTML conditional on a particular category page? Say my permalinks to the category pages are http://www.mysite.com/category/awesome-category How would I cast the <?php if ... ...
0
votes
2answers
129 views

Where do you add code in custom fuctions so it works on a specific page?

Thanks for replying but I still can't get it to work. Is anything wrong with this code? <?php class custom_loop extends thesis_custom_loop { function page() { if(is_page( ...
1
vote
2answers
2k views

How to conditionally enqueue a stylesheet only for a certain page(s)?

Before I get started, I want to acknowledge that there are some really good articles that are targeted at how to conditionally enqueue scripts based on page/post content. WordPress Plugin ...
1
vote
1answer
203 views

How do display simple page for printing product info?

I'm using WP 3.1.2 and latest e-commerce plugin. Now I'm stuck at creating simple page for printing product info. It has to be only product information with not WordPress header and footer. The pop up ...
1
vote
3answers
4k views

If Post Type equals, then display X content

I just need to say in single.php if post type = x then display y. Else, don't display it.
1
vote
1answer
581 views

Condition function for is parent category?

I have a parent category with many sub-categories and I am trying to display the page differently when it is in that specific parent category. But instead of writing the code like ...
0
votes
1answer
279 views

Using PHP Increment and Conditional Statement to Alternate Loop Background

I'm trying to alternate the background on a theme page that is displaying a custom loop: $args = array( 'post-type' => 'portfolio', 'posts_per_page' => 10 ); $loop = new ...
0
votes
1answer
85 views

Problems with my conditionals in single.php by category

In my single.php file I would like to have a conditional that checks for the category of the post and display certain images and layout. Here is what I have: http://pastebin.com/dy6TE1yr
1
vote
1answer
98 views

Conditional Statement - Best Way to Remove Nav on Contact Page

I was thinking of removing navigation on my contact page. I was thinking of inserting a conditional statement and an inline CSS style to "display: none;" if the page template was the contact page. ...
0
votes
2answers
392 views

Dynamically output a class to an anchor tag depending on what tag is chosen

Not sure if this is possible, but what Id like to do is have the ability to output/add a class to an anchor tag depending on what tag I choose when creating the post. My reasoning behind this is to ...
0
votes
1answer
136 views

is_front_page breaks with url parameters generated by a plugin

I have a website that displays a specific layout feature only on the homepage, and this is working fine. However, the client has suggested that they would like the website to be bilingual, and so I ...
0
votes
2answers
455 views

Show image next to the comment author if have certain role

I want to create a badge image for comment author of a certain role, say, Editor. I want to style comments of users with the Editor role differently than comments of non-registered or lower-level ...
1
vote
2answers
2k views

is_front_page, is_page('slug'), is_page(id) not working

None of the following are working to display conditional format in the sidebar when the current page is the home page: is_front_page, is_page('home'), is_page(id) I added an else clause which is ...
0
votes
3answers
264 views

Conditional for Custom Post Types

I have a query that pulls custom post types and regular posts, but how could I tell it to offset just one post type in the query? My query: <?php query_posts( array( 'posts_per_page' => ...
1
vote
1answer
958 views

Need help on creating If-statement for custom meta fields

I'm using Wordpress. I have a movie review website called Filmblurb. For my blog posts, I'm trying to create posts with different categories. Under the "Reviews" category, I have a "Details" box that ...
1
vote
1answer
235 views

Conditional Shortcode image display

Got a problem with a shortcode.. i probebly dont know where & how to set the condition so it will display the right image according to the topic / category of the toturial.. Help Plz :) function ...
0
votes
1answer
121 views

Using conditional statements in place of custom Page templates

How do I use if/ else statements instead of custom Page templates? For example, I create content for static Pages that I want to look different from other static Pages. So instead of using ...