Call   0208 3131682   Mon-Fri 9am-6pm
Category

Wordpress

Buddypress how to remove tabs from groups sub tabs ( eg remove Delete group)

By | Buddypress, Membership sites, PHP, Wordpress | No Comments

This code is based on a post from the buddypress forums tested on Buddypress 2.9.2  ( forum states its compatible from BP 2.6+).

In this example we remove the Delete tab and also permission so that user can’t try and goto the url to access it.

Note there are numerous other examples / versions of this code  scattered about the bp forums that dont work as function bp_core_remove_subnav_item now requires the extra param (see code below).

important: Navigation API has lots of good up to date examples

 

See this post also on hiding the delete tab on the groups from the buddypress forums

 

 

WordPress SQL snippets

By | PHP, SQL, Wordpress | No Comments

A place to keep snippets of useful WordPress SQL.

Do a select based on some meta field of a post ( i.e. search for a post that has a particular metafield  )
In the example above I’m searching for posts with a value for id_vim_node. This is based on this code from stackexchange

Output WP_Query sql code (very useful for debugging WP_Query )

if in the loop

outside of loop

based on this post on stackexchange

Using WordPress as a Company Intranet

By | Intranet, PHP, Web Design, Wordpress | No Comments

planning a WordPress Intranet

WordPress can be a great choice as a company / staff Intranet, but it’s important to first define what features you need. Then to either code the features or choose plugins to use / customise.

Being a programmer, I think WordPress is an excellent intranet choice, the WordPress API allows you to customise things to how you want.

In this article I’ll later discuss some useful plugins for some of the main features.

Common features of a staff intranet

There are many possible features an Intranet website can have, these are probably the ones that nearly all Intranets will need.

  • Company news
  • Knowledge base / Document management System
  • Staff Directory and Profiles

Other features a company Intranet may need:

  • Forms ( online / downloadable printable forms )
  • Staff Events Calendar
  • Blog/s
  • HR section (policies and the like )
  • Social network features (such as groups, group threads, user to user messaging )
  • WordPress integration with Microsoft Active Directory (if you choose WordPress and your on a windows network)

Look and feel and navigation

This is down to preference, but some things to consider are:

  • Company branding
  • A good homepage will have latest news prominently displayed.
  • Good navigation and Search feature to allow staff to navigate to the things that important to them.

 

How to achieve the main Intranet features with WordPress

 

Document Management

WordPress has basic document management built into it as standard through the media library, which for many organisations will do what you need.

For basic Document Management on an Intranet you need to ability to:

  • Upload a file and store it
  • Generate a link to the file that can be used anywhere on the Intranet (allowing easy access)

Once you have this functionality you can create pages and put the documents on the pages, eg you might have a HR (Human Resources) section that has a policy documents page (just add the links to the page). Go to the file in the media library and get the link like in the image below:

If you want to go further, an example might be wanting to have review dates for documents. So you can guarantee that policies and training documents etc are upto date, then a good starting point is the WP Document Revisions Plugin (you’ll need to customise it alittle for review date functionality):

https://wordpress.org/plugins/wp-document-revisions/

Company News

The blog feature of WordPress can be used for posting articles on any topic. If you want to create a company news section, a simple way is to create a category type of ‘company news’ and then add this to any post you want to have in the company news section.

E.g if I wanted a Javascript posts section on my website I could create ‘javascript’ category and then all the javascript posts are on this page: http://www.green-box.co.uk/category/javascript/ ( so long as i tag each post with that category ).

You probably want this also on your homepage, todo this alter the template for the homepage and drop in something like below or use a widget if you have widget areas and don’t want to touch any code https://en-gb.wordpress.org/plugins/category-posts/ .

Staff Directory and Profiles

There are many plugins for creating staff directories, this depends on your needs. A straightforward one is Ultimate member:

https://wordpress.org/plugins/ultimate-member/

Another good one (with lots of features), is Buddypress. This one might be overkill if you want basic staff directory. It has member features for creating a social network – such as groups, member to member messaging and so on.

https://en-gb.wordpress.org/plugins/buddypress/

Conclusion

I hope this gives you some insight in creating an Intranet with WordPress. Although I’ve only touched on some of the basic features here.

If you’re planning an Intranet or would just like to know more, enter your email below to receive my free pdf which goes into much more depth on creating some other features that you might find useful things like:

  • being able to easily create forms
  • integrating WordPress with Microsoft Active Directory

If you’d like my free PDF on Intranet Development with WordPress please enter your email below:

please email me on [email protected]

 

How to add a form to a shortcode in WordPress (using PHP and Ajax)

By | Ajax, HTML, Javascript, online forms, Wordpress | No Comments

Recently I needed to develop a Shortcode that would display a form, this blog post details what I did. I used Ajax ( which seems the best way to add forms to shortcodes, but I’d welcome any input from other developers on your approach).

So without further ado lets get on with adding a form to a shortcode in WordPress.

We need javascript to handle submission of the form via ajax (this presumes you have jquery available), and handle the response from the server. green_form is the form id.

 

Next we need the php to handle everything else, you could put this in functions.php (or include from functions.php) or put it into a plugin. The shortcode to include the form in our page or post is [shortcode_with_form] 

The code handles:

  • the output of the shortcode
  • the server side processing of the form (I’ve just created a stub in this example ( function do_something_serverside )
  • and the including of javascript file required ( if you’d like to know abit depth on ajax forms in WordPress see my post on that )
 

Hope you find this interesting if you’re looking to add a form to a shortcode.

 

 

 

How to get a users Roles and how to list all WordPress roles in PHP

By | PHP, Programming, Wordpress | One Comment

This code is handy if you want to find out a users role/s. You could expand it and check if a user has a given role or similar.

This code is based on examples from:

https://codex.wordpress.org/Function_Reference/get_userdata

and

https://wordpress.stackexchange.com/questions/1665/getting-a-list-of-currently-available-roles-on-a-wordpress-site

If you did want to check if the user is in a certain group you could do something like this:

 

automating sales in Woocommerce

Plugins that can help to increase sales and conversions in Woocommerce 2017

By | Business Growth, Ecommerce, SEO, Social Media, Woocommerce, Wordpress | 2 Comments

There are many great plugins that can help to increase sales in Woocommerce in this blog post I’m going to talk about 2 very effective plugins in this space: AutomateWoo and SumoMe .

 

AutomateWoo for increasing sales in Woocommerce

AutomateWoo has a lot of great features that can be setup to work automatically based on certain triggers, for example:

  • Win back inactive customers by emailing customers that haven’t shopped (after a certain time that you define) a discount code to Woo them back
  • Convert a percentage of abandoned carts into Sales by emailing customers that didn’t finish the checkout, to remind them of what is in their cart.
  • Follow up emails – Ask customers for reviews (good for seo), ask them to share on social media, show them other things they might like

automating sales in Woocommerce

There are many triggers that AutomateWoo can be setup to work on to increase sales and to help get your site shared on social media or content created for free in the form of product reviews. Product reviews is essentially free onsite seo (content). There are many other things AutomateWoo can do such as offer customers rewards and spending a certain threshold and so on.

This plugin has the ability to dramatically increase your sales.

 

SumoMe

This is plugin that pops up before a user is about to leave your website to

  • offer a discount
  • offer a signup form for your email  list (so you can market to them)
  • make it easy for visitors to share your website on social media

SumoMe uses a popup to capture user emails ( I used to hate popups for capturing emails, but this method of capturing emails has really improved in the last few years by building in intelligence to only popup when a user is about to leave your website).