How to delete specific element when it is not homepage?

If I’m understanding correctly, and the code you posted is the full contents of your post, one option would be to only keep the paragraph in the main content, and add the link as custom postmeta. You would then create a child theme and edit whichever places you want links – front-page.php for the homepage, … Read more

Changing author links on homepage to buddypress profiles – without affecting ability to link to author archive throughout the site

Rather than add your filter immediately when the functions.php file loads, find actions that you can hook onto later, when you know the context of the current request, so you can add and remove filters in a targeted way. For example, you might be able to use loop_start to only affect WPBakery output in the … Read more

Send mail to author when custom post type is saved

Try this way: function send_emails_on_new_event( $post ) { $emails=”[email protected]”; $headers=”From: Name <[email protected]>”; $title = wp_strip_all_tags( get_the_title( $post->ID ) ); $message=”New post created”; if ( get_post_type( $post->ID ) === ‘documents’ ) { wp_mail( $emails, ‘New Post’, $message, $headers ); } } add_action( ‘pre_post_update’, ‘send_emails_on_new_event’ ); From the Code Reference: pre_post_update: Fires immediately before an existing post … Read more

How to call a function from functions.php with ajax?

You mean need to display the custom code your ajax add to cart button right? . add this below code your current active function.php file add_action( ‘wp_ajax_woocommerce_before_add_to_cart_button’, ‘hello_world’, 10); add_action( ‘wp_ajax_nopriv_woocommerce_before_add_to_cart_button’, ‘hello_world’, 10); add_action( ‘woocommerce_before_add_to_cart_button’, ‘hello_world’, 10); function hello_world() { $var1 = ‘Hello World!’; echo $var1; echo “The time is ” . date(“h:i:sa”); }

function replace_text for entire page

The reason is to change image urls from site.com/wp-content/uploads to static.site.com. Cdn plugins change to static.site.com/wp-content/uploads so i can not use them. I think it’s better to update the database content instead of replacing strings in each page-load. Check this easy DB replacement tool: https://github.com/interconnectit/Search-Replace-DB Keep in mind to remove it after you’ve done your … Read more