Notify admin (by email) if post added with specific tag

Here is some simple code provided straight out of the WordPress codex. If you are not familiar with the Codex, you should make time to do so. https://codex.wordpress.org/Plugin_API/Action_Reference/save_post function my_project_updated_send_email( $post_id ) { // If this is just a revision, don’t send the email. if ( wp_is_post_revision( $post_id ) ) return; // get the post … Read more

Keep js after reload the page

I understand, that you want “a.music” remain set active after you reload the page. For that you can check whether the cookie is set or not if it is set you make active to the “a.music” else it will remain as same. var tags = getCookie(‘tags’); jQuery(‘a.music’).each(function(){ var dTag = jQuery(this).attr(“data-tag”); if(dTag == tags) { … Read more

My function echos only “array”

You shouldn’t return childpages, you should add variable $ret=””; and in each cycle append foreach(…){ $ret.=”<div…”; } and return it In general you should always return a string(or number) in such functions

What argument does my function need to echo get_results() query results

Why don’t you just do.. add_action( ‘wp_head’, ‘quick_qs_db_css’, 100 ); function quick_qs_db_css() { ?> global $wpdb; $table_name = $wpdb->prefix . ‘qs_css’; $db_css = $wpdb->get_results( ” SELECT qs_the_css FROM $table_name WHERE qs_css_id = 1 ” ); <style type=”text/css” id=”db-css”> <?php echo $db_css[0]->qs_the_css; //outputs null ?> </style> <?php } Seeing as you are using it everytime head … Read more

Custom shortcode with do_shortcode and substr

using php substr requires you add a start point when calling substr function http://php.net/manual/en/function.substr.php A possible fix: function my_shortcode_function() { $string = “”; $string = do_shortcode(‘[different_shortcode]’); $string = substr($string, 0, 4); return $string; } add_shortcode( ‘my_shortcode’, ‘my_shortcode_function’ );

Translation Function missing text-domain [closed]

From WordPress Codex (Link): <?php $translated_text = esc_attr_x( $text, $context, $domain ) ?> The $domain is optional. That´s the reason it´s a warning. Do you have debug set to true? If you want to fix it you have to add the text-domain. esc_attr_x( ‘Search for:’, ‘label’, ‘TEXT-DOMAIN-FROM-THEME’ ) You can find the text-domain in other … Read more