|WordPress

Create Block Templates for Gutenberg in WordPress

Since WordPress 5.0, Gutenberg is the new default editor for content creators. The idea of ‘blocks’ is the main concept behind the new editor. They are components that can be used to add desired functionality to the content in easily manageable sections. Gutenberg editor supports customized templates with pre-populated blocks, which will help you suggest

2019-07-09T22:17:25+03:00By |Categories: WordPress|0 Comments

Add and Remove Block Styles in Gutenberg in WordPress

Every block type in Gutenberg editor can have multiple style options. It is useful to learn how to add and remove them. By using the Block Styles UI for previewing and selecting different styles, you and your editors won’t need to remember specific class names. You can add styles to any block type in Gutenberg,

2019-07-08T18:11:38+03:00By |Categories: WordPress|0 Comments

Create Custom Post Type And Taxonomy In WordPress With Gutenberg

WordPress has gone a long way from being a simple blogging platform to one of the most complex and widely used content management systems. It provides us with several post types by default: post, page, attachment, revision, navigation menu, etc. While these are useful, they are nearly not enough for the various other types of

2019-05-24T21:13:35+03:00By |Categories: WordPress|0 Comments

Remove Scripts And Styles In WordPress

WordPress provides dequeuing and deregistering functions for both scripts and styles. This is very useful for reducing the potential of conflicts with plugins and load time. wp_deregister_script()wp_deregister_style()wp_dequeue_script()wp_dequeue_style() Each of these four functions accepts only one parameter: $handle – the unique name of the script or stylesheet you want to deregister or dequeue. They allow us

2019-05-18T22:47:32+03:00By |Categories: WordPress|0 Comments

Add Styles In WordPress

Wordpress has enqueuing system which provides programmable way of loading styles. It has a built-in support for dependency management. Example: function custom_styles() { wp_register_style( 'my_stylesheet', plugins_url('my-stylesheet.css', __FILE__), array('bootstrap-main'), '1.0', 'screen'); wp_enqueue_style('my_stylesheet'); } add_action( 'wp_enqueue_scripts', 'custom_styles' ); We need to register a stylesheet to be enqueued by using a wp_register_style function. This function accepts 5 parameters:

2019-05-18T22:47:46+03:00By |Categories: WordPress|0 Comments

Check If a Script Has Been Loaded In WordPress

WordPress has a function which lets us detect if a specific script has been enqueued, registered, printed, or is in the queue to be printed.  It can be very useful for avoiding conflicts with libraries which have been already loaded by other themes or plugins. wp_script_is( $handle, $list ); It accepts two parameters: $handle –

2019-05-18T22:48:04+03:00By |Categories: WordPress|0 Comments

Add Scripts In WordPress

WordPress has an enqueuing system which allows developers to utilize the built-in JavaScript libraries rather than loading them multiple times. This helps avoid conflicts and reduces page load time. Example: function custom_scripts() { wp_register_script( 'my_script', plugins_url('my_script.js', __FILE__), array('jquery'), '1.0', true); wp_enqueue_script('my_script'); } add_action( 'wp_enqueue_scripts', 'custom_scripts' ); First, we need to register a script to be

2019-05-18T22:48:18+03:00By |Categories: WordPress|0 Comments

Adding an Options Page in WordPress Settings Menu

When you want to add an options page in WordPress, you need to use function add_options_page. This example will create one page containing a simple sting: add_action( 'admin_menu', 'my_menu' ); function my_menu() { add_options_page( 'Menu Title', 'Page Title', 'manage_options', 'page-slug', 'callback_fn' ); } function callback_fn() { echo "Some text"; } First part of the example adds

2019-05-18T23:04:54+03:00By |Categories: WordPress|0 Comments