0
votes
0answers
64 views

restrict access to specific urls on a specific period of time

I have a countdown timer plugin which is set do redirect the user to a specific permalink after the time is elapsed. I've added a countdown timer here : mywebsite.com/mypost which is set to 3 days ...
0
votes
0answers
28 views

Using conditionals, maybe from a DB, to register & enqueue files, for varying pages, in functions.php

I wanted to include some javascript and css files on only some of my WordPress pages. To do this, I registered and enqueued the files in my child theme's functions.php file, and used conditionals to ...
0
votes
0answers
81 views

functions.php conditional output for a single plugin

hope I've asked this correctly. Bizarre situation. I have some non-breaking spaces in my titles for typography reasons. They are added automatically where required in place of normal spaces by the ...
0
votes
2answers
77 views

exclude custom post type from running a function

I have the following code in my functions.php file to display post shortlink in my posts (I prefer not to edit theme files if possible)... function add_post_content($content) { if ( is_single() ) ...
0
votes
1answer
199 views

Conditional function for excluding first image from content, not working

I have the following function: function remove_images( $content ) { if( ( is_category() || is_archive() || is_home() ) && has_term( 'MyCat', 'category', $postID ) ) { $postOutput ...
0
votes
1answer
37 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!= "" ); ...
3
votes
2answers
2k 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 ...
1
vote
4answers
4k 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 ...
1
vote
1answer
897 views

Can shortcodes contain conditional statements? Even without them my shortcode renders blank page

The following code is supposed to allow for a shortcode that includes many attributes, but not all of the attributes may always be present in which case I do not want the containing element to show ...
2
votes
1answer
737 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 ...
0
votes
2answers
313 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()) { ...