Installing WordPress wp-cli on macOS

wp-cli-macos

Installing  wp-cli on macOS – WordPress has a command line tool which operates similar to what Drush does for Drupal, it is called wp-cli and runs on macOS/Linux operating systems with a minimum of PHP 5.3.2 or later and WordPress 3.5.2 or later. Install wp-cli on macOS curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar Verify Install [email protected][~]: php wp-cli.phar –info PHP binary: /usr/bin/php PHP…

Read More

Add Taxonomy Terms as CSS Classes to a Post

add-tax-terms-css-posts

You can use the body_class filter in WordPress to add the Taxonomy Terms of a Custom Taxonomy as CSS classes to a post. The CSS class appears in the body element and is only used if the post has been assigned to the taxonomy. The code goes in your functions.php file.   add_filter( ‘body_class’, ‘themeprefix_add_taxonomy_class’…

Read More

Change the WordPress Post Type name to Something Else

wordpress-rename-post-type

You can change the default Post type name in WordPress from Posts to something else like News using the get_post_type_object,  normal behaviour of the Posts occur just the label name in the WordPress dashboard has been changed.   add_action( ‘init’, ‘cp_change_post_object’ ); // Change dashboard Posts to News function cp_change_post_object() { $get_post_type = get_post_type_object(‘post’); $labels =…

Read More

Create Shortcode for the Permalink in WordPress

shortcode for permalink in wordpress

You can create a shortcode for the permalink in WordPress to use in a string output or more likely as a value for a link attribute, this can be handy if you can’t use PHP in a certain interface. add_shortcode( ‘my_permalink’, ‘my_permalink’ ); // The Permalink Shortcode function my_permalink() { ob_start(); the_permalink(); return ob_get_clean(); }…

Read More

Add Search Icon After Menu using B Themer with the Beaver Theme

add-search-icon-to-menu

Here’s how you can add a search icon after a menu in a header done in the Beaver Theme using Beaver Themer. Create a Shortcode for the Beaver Builder Search function add_shortcode( ‘bb_search’,’bb_search_shortcode’ ); /* Add Search via shortcode */ function bb_search_shortcode() { ob_start(); FLTheme::nav_search(); return ob_get_clean(); } Create the Header in Beaver Themer Create…

Read More

Add and Show Images in Taxonomy Templates and in Single and Archive Posts

show-category-image-on-posts

You can add an image to a Category Taxonomy in WordPress by using ACF and selecting the categories taxonomy, so now a new image field appears in the category back end page,  the same process can be applied to other taxonomy templates such as custom taxonomies. Create a ACF Image Field for Taxonomy   Create…

Read More

Add Link to the Count in WooCommerce Product Category Menu

product-category-count-link-archive

The WooCommerce product category menu can be manipulated by making a copy of the walker class it is defined in and editing it. The WC_Product_Cat_List_walker class lives in wooc0mmerce/includes/walkers/class-product-cat-list-walker.php, you can make a copy of this and include it in your child theme and include it. Best to create a classes subfolder in your child…

Read More