Reorder or rearrange buddypress menu items

Don’t like the order of BuddyPress menu items? Change it! Use the following code and organize in your way – how you want to reorder the BuddyPress menu items. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters <?php function my_change_profile_tab_order() { global $bp; $bp->bp_nav['settings']['position'] = 10; $bp->bp_nav['activity']['position'] = 20; $bp->bp_nav['friends']['position'] = 30; $bp->bp_nav['groups']['position'] = 40; $bp->bp_nav['blogs']['position'] = 50; $bp->bp_nav['messages']['position'] = 60; $bp->bp_nav['profile']['position'] = 70; } add_action( ‘bp_setup_nav’, ‘my_change_profile_tab_order’, 999 […]

Continue Reading

You may also like

Get All posts by tag in a network – wordpress multisite

If you want to show some selected posts as popular posts across the network, then this snippet is for you You can fetch posts by any tag that is available in your wordpress multisite network and show those to anywhere, maybe in the main site or in any subsite. If you want to show posts from some selected subsites, you just need to pass those blog IDs as an array parameter or if you send an empty parameter it will fetch posts from all subsites in the network. Here is the code: This file contains bidirectional Unicode text that may […]

Continue Reading

You may also like

Show posts based on user preference in wordpress

This is an interesting snippet that will help you to set a preference for the users, so that they will choose their favorite categories and they will see posts from these categories only. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters <?php add_action( 'show_user_profile', 'extra_fields' ); add_action( 'edit_user_profile', 'extra_fields' ); add_action( 'personal_options_update', 'save_fields' ); add_action( 'edit_user_profile_update', 'save_fields' ); add_action( 'pre_get_posts', 'exclude_category' ); function extra_fields($user) { $pref_cat = explode( ',', […]

Continue Reading

You may also like

Remove joined group notification from sitewide activity

This is very little code snippet that will help you to hide some activity notification from the sitewide activity page. When someone joins in a group, we see a notification in sitewide activity page says, “Someone joined the group ABC”. This not that bad, but if your site is attacked by spam users, your activity feed will be flooded with spam notification. So why don’t just hide it? Here is the code snippet: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals […]

Continue Reading

You may also like

How to write dynamic css in a php file in wordpress

It’s always standard to maintain a separate css file for styling, even for dynamic css that is generated by the theme options. Most of the theme developers include this dynamic styles into the header or footer using wp_head or wp_footer hook. How’s about having a totally separate css file for the dynamic styles? It’s pretty simple so let’s start! In my example, I have used redux framework, so that I have a global variable. In my case, I assume my global variable is $lts. So, in functions.php you need to add like this: [php] // Adding custom script add_action( ‘wp_enqueue_scripts’, […]

Continue Reading

You may also like

How to load a wordpress plugin at very last

You need to load your plugin at vert last? Well, sometimes we develop a simple plugin that is dependent to other plugins, something like add-on. So, in those cases, the addon plugins need to be loaded after the parent plugin. Here is a small snippet that need to put at the addon plugin to make sure that the plugin will be load at the last of all plugins. Here you go: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode […]

Continue Reading

You may also like

How to make your wordpress secure, wp config tips and many more

You don’t want your site to be hacked, right? Security should be at the top of to-do list. It doesn’t matter which CMS or platform you use for your website or application or portal, but you need to always think about security. Well, you never can stop a hacker to hack your site, but you can make this difficult for you. Today we are going to discuss about some security issue and wp-config tips. wp-config.php file is the key of a wordpress site, like a foundation when you build a building. Everything in wordpress stand based on this configuration file. […]

Continue Reading

You may also like

Include GitHub Gists in WordPress content

WordPress.com makes it dead easy to include Gists in posts, but that isn’t available in the WordPress software by default.  So let’s add it! GitHub’s Gist service normally provides an embed code to include Gists in other web sites. The embed code is really just a script to load the Gist via JavaScript. Since WordPress normally strips content like that (for security purposes), we’ll use a little shortcode snippet to make it easy to reference Gist code. Here’s that shortcode snippet: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in […]

Continue Reading

You may also like

Limit one blog per user in a wordpress multisite

In a wordpress multisite, an user can create as many blog as he wants. If you Pro Sites you can control this. Pro Sites is a giant plugin that will help you to have control over the whole network. But if you just want to limit one blog per user in a wordpress multisite and don’t want to use a huge plugin like Pro Sites, then this small snippet should help you. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden […]

Continue Reading

You may also like

Easily display member cards with WPMU DEV Membership

Here’s a simple shortcode snippet to let you easily add a membership card for your site’s members when using WPMU DEV’s Membership plugin. This was requested in the WPMU DEV forums, where we love to help members out with simple and useful custom snippets. WPMU DEV Forum topic: Display Membership Data Print/Mobile The snippet adds a [mem_card] shortcode that will then show some member details. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters […]

Continue Reading

You may also like