The conditional-content tag has no wiki summary.
0
votes
1answer
92 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 ...
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 ...
1
vote
2answers
159 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
2answers
114 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( ...
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 ...
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 ...
1
vote
2answers
273 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 ...
1
vote
5answers
177 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
2answers
800 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. ...
0
votes
2answers
893 views
Conditional Statement - check if post has an attachment image
I'm working on a conditional statement (in a loop) that looks for a featured image then grabs a default image if there is none, which I have figured out. But, I also wanted a way to pull the first ...
4
votes
6answers
3k 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()) {
...
2
votes
1answer
556 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 ...
1
vote
2answers
1k 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
2answers
820 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
2answers
273 views
Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?
I have an IF statement shown below that runs one of 2 custom queries, based on the url. The problem I'm facing is if the url contains pagination such as /page/2/, my query breaks because the url isn't ...