Remove # from a Variable [closed]
Just remove the first character of the string: echo substr( $order->get_order_number() , 1 );
Just remove the first character of the string: echo substr( $order->get_order_number() , 1 );
Passing variables through a href link from one page to another page
A ‘better’ way of storing variables for global use is to use add_option() to cache variables and get_option() for retrieving variables. This way everything stored in the database and you can access it anywhere.
Your problem is totally related with pure PHP, not WordPress. You must understand that includes DO NOT break the variable scope. So, the $curauth is only life in author_list.php file and, more specifically, only life inside the foreach($author_ids as $author) loop of that file. In your page template you could use the_author_meta() to get the … Read more
I suspect this is mostly happening because down towards the bottom, you’ve got an input that’s not using $this->get_field_name() (the first of the two checkbox inputs). Try using $this->get_field_name() as you did in the “then” clause of that section of code and it should be OK. Not much else wrong that I can see.
You could just get the permalink and strip the home root from it- $path = substr( get_permalink(), strlen( home_url(“https://wordpress.stackexchange.com/”) ) );
You can turn your snippet into a function that returns the post thumbnail URL of a post: function wpse81577_get_small_thumb_url( $post_id ) { $thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), ‘small’ ); return $thumbSmall[‘0’]; } Usage, supplying the ID of a post: <?php echo wpse81577_get_small_thumb_url( 59 ); ?>
I finally figured it out – I was missing the line extract($args); inside function widget($args, $instance). Now everything works as expected.
You appear to be quite close to having this all sorted out. If you wrap your queries in a function, and separate the logic and presentation: <?php function wpse_158425_get_terms(){ global $wpdb, $rpt_options; $wpdb->show_errors(); $rpt_days = $rpt_options[‘number_days’]; $rpt_term_ids = $wpdb->get_col(” SELECT term_id FROM $wpdb->term_taxonomy INNER JOIN $wpdb->term_relationships ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id INNER JOIN $wpdb->posts ON $wpdb->posts.ID … Read more
passing javascript variable into php wordpress