The tag has no usage guidance.

learn more… | top users | synonyms

-2
votes
0answers
35 views

How to load conditional dropdown field data in WordPress [on hold]

I have been developing a website which contain a product page (Catalogue, no cart). Each product will have a set of variation that will be revealed/or removed dynamically depending on the choices the ...
3
votes
2answers
1k views

Display only certain posts based on visitor's country?

Is it theoretically possible to have the following feature? Each post has a country code. When a visitor comes in, the system will determine the visitor's country code. Then when the page renders, ...
0
votes
0answers
21 views

How to set cookies and use it for redirection?

On WordPress, I have a page in which I call an iframe to display an other page (which is on another website). This other page is depending on the days past. The first day, I want to display page1 ...
0
votes
0answers
19 views

How do I add a button to run some code on a page when the button is clicked

I have a this conditional code below and I'd like to know how to add a button that when clicked will 'run' the code indicated. I have no experience with ajax/jquery but I assume it is what is needed? ...
0
votes
1answer
42 views

Condition within single.php to send an email to the post author

I have this piece of code (below) that checks if the post was modified within the past 7 days. I'd like another piece of code that I can insert where "Needs Updating" is that will send a basic email ...
0
votes
1answer
32 views

Conditional featured image with youtube thumbnail

Basically what I am trying to do here is: Display the youtube thumbnail. If no youtube thumbnail -> Display the Featured image for the post. If no featured image -> Display the fallback image. ...
1
vote
1answer
22 views

Location-Based Content

I am building a site that has pages that have a contact pod that has 11 different dropdowns in wp-admin via Advanced Custom Fields. Based on the user's IP, I want to display one of those 10 contacts (...
0
votes
1answer
46 views

Understanding and using did_action() in a conditional statement

I'm working with Genesis Framework in a custom theme, but this is not a question "genesis-specific". I need to populate the sidebar of my pages (not posts) conditionally. The condition is to check ...
1
vote
2answers
670 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
2answers
53 views

If user is logged in and has a role echo statement

I currently have a dive set up which I would like to display different bits of information when the user is logged in and has a specific role. I have three roles 'administrator' 'adoption-agency' ...
0
votes
1answer
72 views

ACF loops false value with repeater and checkbox

I have an ACF repeater field setup on a page and within the subfields I have a True/False checkbox. So far, if the box is checked, it will show the fields. If not then it will not. However, the one ...
0
votes
1answer
85 views

How to display content If function exist/condition true?

I've created my custom posts. Data from the same is displayed in let's say single-custom-post.php. Now to clean that file and to remove 100 lines of code, I want to make a new file (let's call it ...
0
votes
0answers
23 views

Choose custom sidebars in post edit

Is there a way to have a dropdown of all available sidebars show within the post menu? Something kind of like this - Custom Sidebar only on single post - but being able to pick and choose which ...
3
votes
5answers
9k views

Why isn't is_page working when I put it in the functions.php file?

I have page called "Apple", the page's ID id 2533. In page.php file I have line: echo $bannerimg And this function in functions.php: if ( is_page( '2533' ) ) { // also tested with 'Apple'...
55
votes
6answers
125k 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 testing for only a ...
12
votes
3answers
5k views

Enqueue Scripts / Styles when shortcode is present

What is the idea way to register/enqueue scripts and/or styles for use in plugins? I recently made a plugin simple plugin to add the user avatar/gravatar with a shortcode. I have different style ...
0
votes
0answers
23 views

display menu depending on selection on homepage

Like I wrote in the topic On my homepage there are two links: business and consumer depending which link I choose I want to display a certain get_template_part (menu) So If you click on "business" ...
0
votes
0answers
25 views

Displaying no post message in rather complex query that shows only future events

I'm trying to do something rather simple, which is display a message if there are currently no posts available. However, the environment I want to do it in is rather complex, as I'm using the Types ...
0
votes
1answer
28 views

do_action in conditional

I'm using the "inbox-status" plugin. I can use this to display unread emails. <?php do_action( 'inbox_status_count', 'inbox-unread' ); ?> I want to use this code in a conditional. Only the ...
0
votes
1answer
63 views

Display content based on Author Custom Post type

I have 2 forms. Form A creates a new user with the role of Author and also creates an entry in a CPT called Judges. Form B creates a new user also with the role of Author and creates an entry in a ...
0
votes
1answer
83 views

Jetpack: Display Site Title when no Site Logo

How do I use an if else statement to display site title if no site logo is selected in the customizer when using jetpack? I have php code written but it's not working. I think it's because ...
4
votes
6answers
12k 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 ...
0
votes
1answer
54 views

Alternate text if shortcode returns no data

I'm using some plugins like beer list from Rescuethemes, and an event list, that use a shortcode to display a list of items. I put the shortcode into a Page, and it shows the data. If the shortcode ...
0
votes
2answers
82 views

How to make a conditional statement within $output in shortcodes.php?

I've got a shortcode that's got HTML in an $output field that's lovely. I just want to add one paragraph to it at the bottom that's conditional on this statement: <?php if ( get_post_meta( ...
0
votes
0answers
34 views

Adding condition to a Form plugin

I am trying to figure out how to get my Form plugin which I had it customized to do a certain thing for a specific form (lets sat form #100) to not to do the same on other forms that are being created....
5
votes
8answers
6k views

wp_enqueue_script adding conditional statement not working

This is the code im using in my functions file: add_action('init', 'sort_out_jquery_pngfix_frontend'); function sort_out_jquery_pngfix_frontend() { global $wp_scripts; if(!is_admin()) { ...
0
votes
0answers
89 views

Displaying the current category if post has more than 1 category assigned to it

I have category links in my nav that link to category pages. For example: Cars Trains Planes Automobiles If posts have two or more assigned categories to it is there any way to check for the ...
0
votes
0answers
33 views

Display the_date() but force the_time() behavior if format is different

In my blog, there are two post formats, standard and link. For standard posts, the date of publishing is always shown at the end of the post, no matter what, and never above its title. For link ...
0
votes
2answers
2k 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;...
0
votes
0answers
33 views

customizing wordpress theme slider with switch statement

i am working on an assignment for wordpress , i need help in following matter, im using wordpress today news theme, the link of my current work ca.unitysofts.com in upper three slider , while ...
0
votes
1answer
58 views

A conditional button

I wish to add a button to a page of my site that redirects the user to the signup page, if he is not a registered user, and to another page of the site, let's say Test_Page, if he is a registered user....
0
votes
1answer
5k views

Conditional required fields for Wordpress Contact Form 7

I know this might be considered off topic but I am not sure where else to post this as it also pertains to WordPress as well as the plugin Contact Form 7. If you know where I should post this other ...
0
votes
2answers
143 views

Widget logic conditional widget

Is there any experience using widget logic, I want to display a widget on single custom post type with specific taxonomy. Tried using is_tax(taxonomy_name) || is_single() && in_term(...
0
votes
1answer
32 views

How Can I Register Menus and Widgets Conditionally Based on Theme Options/Settings?

I have theme options/settings page and options/settings fields set as outlined here: http://code.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-2-sections-fields-and-...
0
votes
1answer
67 views

Best Method to Switch Between Terms (Custom Taxonomy)

Looking to learn something, here. With the following code, I am loading an external file for each condition based on a known set of custom terms. I'm using has_terms to check for a specific value ...
0
votes
2answers
38 views

Nested conditionals

Got my brain scratching round a wee issue here. In short... If home page, then do nothing if page has a thumbnail then run code that pops the page title on top of full width thumbnail with ...
0
votes
2answers
269 views

If else statement based on referral URL

I am trying to display content in a custom template based on referral URL. I put a link in my footer called http://domain.com/?ref=special and image2.gif shows still when I click it and go to the ...
0
votes
1answer
22 views

How to make a hyperlink conditional according to whether you are logged in or not

one of the sections on my home page has a hyperlinked header. I have a multi-user site so I would like that header to take the user to a specific shop category (product-category/aktiviteter/) if they ...
0
votes
1answer
74 views

How to display image on condition that a selection has been made

I have a custom post type 'Holidays' and a custom field (created using Advanced Custom Fields) called 'activity_rating'. The activity_rating field is a select dropdown with values 1 to 5. If the ...
1
vote
1answer
92 views

Show different different menu in theme_location depending on x

I would like to display a different menu in the same theme_location depending on some condition. I'm wondering if this is possible and if so how? I would like to avoid registering an additional ...
0
votes
2answers
29 views

Force Log in to view a page

So I have a page (ex. site.com/start) where I want to show a login page (ex. site.com/start/login) if not logged in, in order to view the page. Without using any plugin, what would be the condition ...
0
votes
1answer
130 views

Check if sidebar is rendered?

I want to check if there are sidebars rendered on the front end and if so output some body classes so I can style the page differently. I tried using is_active_sidebar but that just returns true if ...
2
votes
2answers
401 views

different child theme for subdomain

I've got a site that I'm trying figure out how to apply different child themes to based on a subdomain. Applying the child themes shouldn't be difficult, it's more the .htaccess magic that I'm a bit ...
4
votes
2answers
225 views

Display several random posts, but make sure a condition is met

I have a custom post type for a group of people (employees). At first, I needed to display 7 random employees. That was easy <?php $args = array( 'post_type' => 'employees', ...
0
votes
1answer
76 views

Issue in If else condition [closed]

I'm calling my all pages on one pages as a section. Here is my code: <?php $args = array( 'post_type' => 'page', 'orderby' => 'ASC', '...
0
votes
1answer
45 views

Banner appearing on Pages but not Posts; call it conditional confusion

I have a banner image that appears on Pages that I want. However, I also have a Page designated as a Blog where it doesn't appear. Is there any way to have this banner appear on a Page that is using a ...
0
votes
1answer
142 views

How to Conditionally Not Display a Link Based on Current URL?

I have a sidebar with links to 4 guides that I wrote... When users are reading one of my guides I only want to show them the links to the 3 other guides, so no link to the guide they are currently ...
-1
votes
1answer
819 views

Wordpress equivalent to Drupal Views? [closed]

Is there a Wordpress plugin that provides a subset of the functionality found in Drupal Views? Specifically, I'm looking for the ability to use a Views-like plugin to pull in fields of content based ...
0
votes
1answer
61 views

Different titles for static, posts, and every xy page

I have: a static front page "Home" a page with all my posts "My posts" all the other post/pages from the blog "Post x / Page y" and each one of them should display its title in the header. I'm ...
0
votes
0answers
20 views

Whats a good strategy for localising WordPress post and page content?

I'm aware of the various functions for localising elements of themes and plugins - __(), x() and the textdomain concept but how does one go about providing localised versions of actual post and page ...