Create a General Settings Page with ACF

Create a custom General Settings page using Advanced Custom Fields (ACF) to manage global theme options from the WordPress admin panel. /* create general setting tab */if(function_exists(‘acf_add_options_page’)){acf_add_options_page (array(‘page_title’=>’General Setting’,‘menu_title’=>’General Setting’,‘menu_slug’=>’theme-general-settings’,‘capability’=>’edit_posts’,‘redirect’ => false));}

Read more →

Enqueue Scripts and Styles in WordPress

WordPress provides the wp_enqueue_style() and wp_enqueue_script() functions to properly load CSS and JavaScript files. Using the enqueue system ensures that assets are loaded in the correct order, prevents conflicts with plugins and themes, and follows WordPress coding standards. In the following example, multiple CSS and JavaScript files are enqueued, including the theme stylesheet, Slick Slider, […]

Read more →

Register Custom Image Sizes in WordPress

WordPress allows you to create custom image sizes using the add_image_size() function. This ensures that uploaded images are automatically resized to match your theme’s design requirements, improving performance, consistency, and image quality across your website. In the following example, multiple custom image sizes are registered for different sections of the website, including the homepage, sliders, […]

Read more →

Complete Code to Register Custom Post Types and Custom Taxonomies in WordPress

In this example, we’ll create two custom post types Testimonials and Projects using the register_post_type() function. We’ll also register four custom taxonomies Type, Material, Service, and Category for the Projects post type using the register_taxonomy() function. Simply add the following code to your theme’s functions.php file or a custom plugin. Once added, you’ll see the […]

Read more →

How to Create a Custom Post Type in WordPress

Use the snippet below to register a Testimonials custom post type in WordPress. Add it to your theme’s functions.php file (or a small custom plugin), then save and refresh Permalinks. PHP code Next steps

Read more →