Quite simply add this near the apply_filters or do_action.
WordPress by default will preserve capitalization in filename for images. To make filenames lowercase automatically. Add the following PHP code snippet in your favorite code manager plugin like Scripts organizer and set it to load on front end:
Oxygen page builder Image element does provide the feature to insert an Image-type custom field’s Alt text using the dynamic data. but if you need overwrite then see 2nd option. Step for show alt tag for image. Ensure that your Image field’s Return Format is set to Image Array in your ACF field group. Step 2 Option 1 Option…
By default WordPress search query looks for the searched text in Post Title and Post Content as well. But that makes the search very robust and doesn’t feel a useful search. So here is the code if you want the WordPress default search query to look only in Post Title.
Sometimes you have a situation where you want the customer to log in, like a donation page, but you don’t want them to end up at /my-account/ but rather be taken back to the page where they were when they started. This code is useful for donation sites, as well as refer a friend scenarios.
Click anywhere within code block to automatically copy to clipboard. Code is taken from WPJohny’s plugin. But to reduce number of plugins I moved it to Scripts Organizer.
This snippet is good for e-commerce stores or anywhere that customers can be logged in, it ensures they don’t see the default WordPress login page, but are instead taken to the home page.
This snippet allows you to style the very top of your website on a mobile device for that extra touch of professionalism. Change “#000000” to your brand colour. This is a HTML snippet.
It’s easy to forget to turn indexing back on after you’ve finished developing a site, this snippet will remind you. No extra plugins are necessary. This should be a part of every template you have. Load this in the admin area only.
Sometimes you have a post type that needs to stay private, like video tutorials for your clients or a quotes for products that should not be seen by the public or indexed by the search engines. The snippet below will allow you to set all posts from a given post type to private by default.…
This snipet create a shortcode that you can use on any post to show estimated reading time in minutes. It will simply return a number of minutes. Shorcode: [reading_time] or [reading_time wpm=”100″ gt=”true”] parameter wpm is words per minute value, default is 300 and if you use gutenberg blocks, set gt parameter to true
Sometimes is usefull to see if some post or page have feature image or not, this code will add small image at end of tables in admin pages and posts sections. It register new image size 120×120 that is used in this case.
With this example you can easily add cart count or total price anywhere on your webshop. This code uses woocommerce add to chart hook that is executed every time when you put something into basket. You just need to add this code anywhere where you wish to show total price. And this snippet will execute…
If you are using SlimSeo plugin it automatically add all posts and taxonomies into sitemap.xml file. This snippet allows you to exclude some post types and taxonomies from sitemap file. In this snippet above from sitemaps file will exclude ‘help’ and ‘slider’ post type, and ‘category’ taxonomy.
Are you Curious how to remove the slug of a custom post type in WordPress? If you’re using CPT UI, there’s an option called With Front but that doesn’t always seem to work. Follow this tutorial, add these two simple functions and the slug will be removed from your custom post type URL. Note –…
If you would like to get rid of the “Category:”, “Tag:”, “Author:”, “Archives:” and “Other taxonomy name:” in the archive title, use this little function in Code Snippets The Below can be added using a plugin like Code Scripts organizer or Code Snippets.
Here is a way to add WooCommerce cart icon to a menu with the cart item count, it links to the cart page and displays the number of items that have been added to the cart.The code uses three functions which need to be added to Snippet plugin. Create a shortcode for the WooCommerce cart,…
For retrieving the best buying products in WooCommerce we are using wp_query manipulation with meta_key as “total_sales” and orderby “meta_value_num”. In short we are displaying products as per the total sales number. Here is Screenshot for repeater / easy posts Step 1 – Select Advance WP Query Step 2 – Setup Advance WP Query as…
Sometimes is usefull to add additional text under the product price. With this hook you can easily show additional text just under the price. You can use ScriptOrganiser, CodeSnippets or any other similar plugin. This hook could be extended to show message only on specific products. In this case you will need to add ID’s…
3rd party plugins admin after_body Alt archive Blocks Category clean up composite elemenets core CPT CSS Custom Custom Post Dashboard flexslider Front End FSE full site editing Gallery hook HTML Image load styles Must Have notice Oxygen Password Permalink plugins Post List Publish Date repeater settings page share single product Taxonomy Taxonomy Term themes Tips Topbar WooCommerce wordpress WP Admin WPML