Overwrite URL on blog posts

If you are not using Custom Post Types the following in your permalink settings should work just fine. /blog/%postname%/ Screenshot (Below can still be applicable depending on your use of custom post types) Keep your regular permalinks on blog like you have it in settings. And in your custom post type arguments the “with_front” Boolean … Read more

direct custom post query interferes with other queries on page

You might be looking for wp_reset_query You would insert this after your return. add_filter(‘pre_get_posts’, ‘query_post_type’); function query_post_type($query) { if($query->is_category() || $query->is_tag() || $query->is_home() && $query->is_main_query()) { $post_type = get_query_var(‘post_type’); if($post_type) $post_type = $post_type; else $post_type = array(‘post’,’my_custom_post_type’); $query->set(‘post_type’,$post_type); return $query; } wp_reset_query; } I really hope this helps.

How do i get a specific user metadata using custom metavalue outside of wordpress?

If you have billing_phone as user meta, which is the preferred way, that query would be incorrect. The advantage of utilizing custom user meta and adding a field for billing_phone would allow you to use get_users(). $user = get_users(‘meta_key’ => ‘billing_phone’, ‘meta_value’ => $phone_number, ‘fields’ => ‘ID’); The above would give you an array of … Read more

Replace the attribute_escape to esc_attr()

Deprecation is… status applied to features, characteristics, or practices to indicate that they should be avoided, typically because they have been superseded. In other words, attribute_escape has been replaced by esc_attr. Any time you use a deprecated function WordPress triggers the error you’re seeing. Somewhere in your codebase a deprecated function is being used. To … Read more

WordPress function breaks widget’s markup?

wp_list_pages does not wrap it’s output in a ul or ol tag. That’s up to you. In other words, if you just call wp_list_pages, it’s going to spit out a bunch of li tags, which your browser assumes is wrong and “corrects” the html as it sees fit. Try this: function widget( $args, $instance ) … Read more

Run WP inside a other Site without using frames

Is your other website in the same server? You can include wp-load.php to your other website (located in the root of your wordpress installation) and get the content from there. Of course you’ll have to include stuff like the javascript libraries and the css used in wordpress (mainly those used in front end). For different … Read more

shortcodes inside shortcode to sum values

You can try this: add_shortcode(‘sumsc’,’sumsc_func’); function sumsc_func( $atts, $content = null ) { $sum=0; preg_match_all(‘/stat([0-9]+)/i’, $content, $matches); if(isset($matches[1])){ $sum = array_sum($matches[1]); } return do_shortcode($content).” <div>The sum is <strong>”.$sum.”</strong></div>”; } This will add the total sum at the end of the shortcode content. Usage example: You can try this in your editor: [sumsc][stat1 val=”usa”] [stat2 val=”europe”] … Read more