how to change “posted by” words

This can MOST LIKELY be done with the get_text filter. Here’s an example (and then some caveats): function my_theme_text_switcher( $translations, $text, $domain ) { if ( $domain == ‘my-theme’ && $text == ‘posted by’ ) { $translations = __( ‘YOUR TEXT HERE’, ‘my-theme’ ); } if ( $domain == ‘my-theme’ && $translations == ‘on’ ) … Read more

How can I pass a shortcode value to the head in wordpress functions.php

Shortcodes, as I understand them, are to be used inside content of pages/posts, and (with 4.9) widgets. They aren’t supported inside other spots on the page, only in the page/post/widget content. From the Codex: https://codex.wordpress.org/Shortcode [WP] only expands the shortcodes within the content of a Post, Page, or custom post type. But I don’t think … Read more

Replace plugin function with a custom function?

For your question how can I replace this function . You don’t need to replace it. The function has a filter on the returns value, not an action. You don’t need to remove it, just filter the result. So you can create a new function and call it with add_filter(‘sep_the_event_end_date’, ‘yourfunction’); Put this in your … Read more

Init action and refresh page after form action

From the documentation: https://developer.wordpress.org/reference/hooks/init/ add_action( ‘init’, ‘process_post’ ); function process_post() { if( isset( $_POST[‘unique_hidden_field’] ) ) { // process $_POST data here } } In your example, perhaps having two different add_action is causing problems and burying your function where it’s not firing during init I’m going to test a similar solution and see what … Read more

How to properly refresh page after form action?

Searching around and not being able to implement the action through init hook I’ve found this workaround which for sure isn’t the best but does the job nicely. echo “<script type=”text/javascript”> window.location=document.location.href; </script>”; at the end of $_POST instructions. If somebody has a better solution, welcome to share.

How to include any template using Shortcode fuction?

You can’t return the include statement. And you shouldn’t use include template parts. And here’s how to do it correctly: function custom_code() { ob_start(); get_template_part( ‘custom-template.php’ ); return ob_get_clean(); } add_shortcode( ‘custom_shortcode’, ‘custom_code’ ); So what we’re doing here is: Start output buffering. Include given template part using get_template_part function. Return all the output generated … Read more