How to add text to the start of all comments?

You can try the comment_text filter: /** * Prepend text to each comment content. */ add_filter( ‘comment_text’, function( $comment_text ) { $text=”Some text”; return $text . $comment_text; }); if you’re displaying the comment text with: <?php comment_text(); ?>

Execute a function every hour in the background

I setup something similar. Using IIS – look into writing a .bat file which fires off a php shell script to do whatever it is you need to accomplish. once you have that bat file working, setup a “scheduled task” in IIS http://technet.microsoft.com/en-us/library/cc721871.aspx if you are on a linux system, then use crontab https://www.freebsd.org/doc/handbook/configtuning-cron.html If … Read more

Syntax error in a shortcode function

You need to escape your quotes, or use doubles, or use heredoc: // Escaped return ‘<div id=”xxxx-xxxxxx”></div> <script type=”text/javascript”> window._taboola = window._taboola || []; _taboola.push({ mode: \’xxxxxxx-xxxxx\’, container: \’xxxxxx-xxxxxxx\’, placement: \’one word word\’, target_type: \’mix\’ }); </script>’; // Doubles return ‘<div id=”xxxx-xxxxxx”></div> <script type=”text/javascript”> window._taboola = window._taboola || []; _taboola.push({ mode: “xxxxxxx-xxxxx”, container: “xxxxxx-xxxxxxx”, placement: … Read more

Get title attribute from galleries

WordPress actually uses a Built-in Post Type for Attachments ( called attachment ) so you can use some of the same functions like get_the_title() which is what you’re looking for. Though, I did take some liberties by modifying your code below, using a foreach instead of a for loop: $gallery = get_post_gallery( 7, false ); … Read more

Add shortcode in my div

You need the do_shortcode() function <?php echo do_shortcode(“[contact-form-7 id=”54″ title=”Contact form 1″]”); ?> I have not tested your shortcode.

Ajax button not working

As for your PHP not being executed – the action parameter in your JavaScript AJAX call needs to match the hook name in your add_action call. Take a look at the example below. I haven’t tested it but it should work. I have simplifed the AJAX call, feel free to modify it to suit your … Read more