Tag Info

New answers tagged

2

Redefining a WordPress core function that might be used all over the place by the core, the theme or plugins isn't a very good idea in my opinion. Because it might be used in those occasions expecting the default value to be what default is, which might lead to breaking things. So it is actually not just not a very good idea, it is a terrible one - in my ...


1

You're right. The code you had didn't use any logic to determine whether to add the CSS class or not. Try this: function skips_add_update_status($classes) { //Instantiates the different date objects $created = new DateTime( get_the_date('Y-m-d g:i:s') ); $updated = new DateTime( get_the_modified_date('Y-m-d g:i:s') ); $current = new ...


2

The dashboard_glance_items filter is only useful for modifying the extra elements. The posts/comments data elements have already been displayed. Here are three ideas: Method #1 - Use the dashboard_glance_items filter: You can use the following filter setup, to remove the posts/pages/comments elements from the output of wp_dashboard_right_now(). The ...


3

Unfortunately, there is no 'filter' to remove or edit the previous items in the 'At Glance' box. EDIT I removed the "Wordpress Core Hack" part because I don't want to encourage such a behavior, and I don't want you to edit the code every time Wordpress releases a new version :) And here is a code to append custom post types stats without being clickable : ...


-2

Plugins are to extend and add to the functionality that already exists in WordPress. you can create your own.


-2

Plugins is a centralized solution. You can implement your functionality via theme. use : wp_enqueue_script, wp_enqueue_style


0

Plugins usually increases the site functionality and performances.We can add additional plugins for doing some features that are not in basic wordpress.


0

I think you're looking for this... wp.getPosts({ status: 'trash', }, ['title','status'], function( err, data ) { console.log( data ); } });


0

After asking around and looking for alternatives, I came up with a working solution that works in the web frontend and in the Android/iOS XML-RPC based apps. This is the filter. add_filter('wp_insert_post_data', array($this, 'save_content2'), 9, 2); I am pretty sure it is called before the content_save_pre filter. It allows direct access to the post ...


0

Managed to figure it out in the end by modifying one of the core files of the plugin If you look in json-api/models/post.php there's a function set_content_value() which shows where the plugin is pulling in the content. Here you can modify it as needed, in my case I used it to remove certain shortcodes with the Wordpress remove_shortcode() function


0

When calling bp_loggedin_user_avatar(), you can set the 'html' attribute to false and it will return just the URL of the avatar (instead of the full HTML). Then you can style it how you want. Something like: $avatar_url = bp_loggedin_user_avatar( 'html=false' ); echo '<img class="media-object" src=' . $avatar_url . ' width="' . ...


0

Untested: function custom_home_exclude( $where = '' ) { $exclude = array(); $newsQuery = new WP_Query (array( "post_type" => "news", "meta_key" => "post_to_blog", "meta_value" => 1, "meta_compare" => "!=", "posts_per_page" => "-1", )); while ($newsQuery->have_posts()) ...


1

You don't need to create additional functions, just re-use what you already have and tweak it a bit: function theme_add_bootstrap() { wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/third_party/bootstrap/css/bootstrap.min.css' ); wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . ...


1

In short: WordPress uses the term count in various places. There's even another count that it's in the options table. So as long as you are talking about the core behavior, then the recommendation is: Never ever touch the WordPress cores term counting mechanism! It's hard enough to bring it to work in some cases (manually updating term stuff in very, ...


0

Maybe in the custom_rewrite function, try concatenating $wp_rewrite->rules and $feed_rules using array_merge, then returning $wp_rewrite. function custom_rewrite( $wp_rewrite ) { $feed_rules = array( 'local/(.*?)/(.*?)/?$' => 'index.php?page_id=41&trade=' . $wp_rewrite->preg_index(1).'&area=' . $wp_rewrite->preg_index(2), ...


1

This could be the matter of adjusting the priority of your filter callback, since the plugins files are executed before the functions.php theme file. That could explain why it works in your functions.php file, if the priority is the same. When you add the code snippet to a plugin, it might be executed before the other plugins that use the same filter. The ...


1

Your use of the_content filter is wrong. Please check how it should be properly used in the codex in the link supplied First of all you are totally replacing the_content with nothing, that is why you get a blank screen. The reason is that you are not calling the $content variable in your function Secondly, if you've called the variable, you would have ...


0

i didn't want to use js, i wanted a php solution, plus i also manipulate all internal links into anchor links. in the end, you have to decide for yourself, what would be the best way for you, php or js. this goes into functions.php inside the current theme folder. add_filter('the_content', 'crawl_content'); function crawl_content( $text ) { $url = ...


0

You could try using the terms_clauses filter function wpse156370_terms_clauses( $pieces, $taxonomies, $args ) { global $wpdb; $pieces['fields'] .= $wpdb->prepare( ', (SELECT COUNT(*) FROM ' . $wpdb->posts . ' p, ' . $wpdb->term_relationships . ' p_tr' . ' WHERE p_tr.object_id = p.ID AND p_tr.term_taxonomy_id = ...



Top 50 recent answers are included