rtCamp notes, day 33 of undefined
Localisation in a JS How do we localize a JS file? As we cannot directly implement localisation in a JS file, wordpress provide us with a workaround to do that. If we need to pass a variable from PHP to…
Localisation in a JS How do we localize a JS file? As we cannot directly implement localisation in a JS file, wordpress provide us with a workaround to do that. If we need to pass a variable from PHP to…
Some functions I explored today, the parameter is not a valid parameter, but it is just for understanding of me to see what parameters it can accept. Revision: Hierarchy Front Page if front page is a static page -> move…
Adding features to your theme, WordPress allows us to add some predefined features ( activate some pre defined features on our theme ), We can add the code add_theme_support( $support_name, $arguments ) to our themes functions.php to activate them, Some…
Functions to get the theme directories: Some things about the enqueuing the style/script The third parameter for the style/script enqueue function accepts a dependencies array, which means the handle on which our style/script will depend on → our style/script will…
WordPress Rest API REST API List Posts Endpoint We can use this endpoint of the rest API to fetch posts in JSON format to be used as AJAX or some other feature. In this, we can change the post-type parameter…
How to create a Page Template? We can create Page Template in WordPress as well, page tempalte are the ones which are selected while we are editing a post in the right sidebar, we have an option named Template We…
Hierarchy Front Page front-page.php if front page is a static page -> move to the Page hierarchy from here.else, home.php index.php Single Post Type (except page) Attachment Post Type– {mimetype}-{subtype}.php -> image-jpeg.php– image.php– attachment.php– will go to Custom Post Custom…
Template Files Read previously that template files holds the information for our theme template. There are various types of template files. Post template files Page template files Attachment Template Files Custom Post Type template files Partial and Misc template files…
Enqueuing Files In our site we can enqueue ( load in front end ) script or styles as per our need.Instead of directly ( custom ) loading those files by hardcoding script or link tags in our theme/template, we can…
Template Functions wp_head() -> This function fires the wp_head hook which prints the header files which have been added to the wp_head action by plugins and other things. We add it to include/display other header scripts in our template. ->…
WordPress Themes Themes are the main front-end design giving elements -> They hold the template and design files for the WordPress website. Themes are like plugins, they come in a zip package and can be installed in a similar way.…
Some quick random learnings Enquing JS & CSS files instead of loading them manually via code The function register_scripts should contain our code to enque scripts and stylesheets. Always try to decrease the number of times the code repeats, instead…