_e
This function lets you display translated text on your page. First argument is the text to translate, second is the theme text domain.
copy
This function lets you display translated text on your page. First argument is the text to translate, second is the theme text domain.
copy
Append css class to body using filter.
copy
Add this method to the function.php file. It will append a stylesheet file in the admin area of WordPress so you can add your custom CSS in the editor. Don't forget to update path to the file.
copy
Modify and add it to the function.php file. It allows to add tags to the head section of the site.
copy
Register in the functions.php to add a new autogenerated image size for you posts and pages. Use name, width and height attributes to define the new size. By passing 9999 as a value of width or height the image will retain its original size for that dimension.
copy
Adds post meta data fields to returned JSON data in the REST API. You can use it for default post types or custom ones.
copy
Use add_shortcode function to register shortcode for later use. The first parameter is a name of your shortcode, the second is a callback function where you can add the content to return.
copy
Use this filter to add a slug-based css class to each menu item.
copy
bloginfo function prints information about your site. Pass an argument to return name, description, wpurl, url, admin_email, charset, version, html_type, text_direction, language, stylesheet_url, stylesheet_directory, template_url, pingback_url and more.
copy
This snippet checks if the logged in user has admin permissions and executes code if true.
copy
Check if post type matches the slug.
copy
When registering a new custom post type you can encounter a bug where a single custom post returns a 404 page even when a valid page template exists. To fix it add the following snippet to the functions.php file. Make sure to remove it once the bug is fixed as you do not want it to run with each page load.
copy
Pass arguments to WP_Query with a tag of a custom post.
copy
Disables Gutenberg editor and brings back the Classic editor. Additional actions remove related styles too.
copy
In the root directory open the wp-config.php file and add the following code before the "That's all, stop editing! Happy publishing" comment. It will disable Theme Editor in the Admin area located in Appearance section. To enable it again, change the Bool attribute to false.
copy
In the root directory open the wp-config.php file and add the following code before the "That's all, stop editing! Happy publishing" comment. It will disable Theme Editor in the Admin area located in Appearance section and the options to update Themes and Plugins in the CMS. To enable it again, change the Bool attribute to false.
copy
Use do_shortcode function to output WordPress shortcodes in the code.
copy
In the root directory open the wp-config.php file and add the following code before the "That's all, stop editing! Happy publishing" comment. Next, login to your WordPress admin panel and go to Tools > Network Setup to configure it.
copy
You can enable post and page revisions by adding the following line before the "That's all, stop editing! Happy publishing" comment in the wp-config.php file. If the attribute is set to 'true' WordPress will store all revisions for the posts. Setting it to 'false' will deactivate revisions altogether. Finally, you can pass a positive integer to set the maximum number of stored revisions.
copy
Enqueue WordPress dashicons to frontend. By default dashicons are only available in the admin area. Add the following code to the functions.php file to use WordPress icons anywhere in your website.
copy
esc_html is a method allowing you to escape html from a string passed as an attribute.
copy
esc_attr_e prints and escapes translated text.
copy
esc_url is a function cleaning up a url. It escapes and cleans special characters.
copy
Using get_bloginfo lets you access information about your site. Pass an argument to return name, description, wpurl, url, admin_email, charset, version, html_type, text_direction, language, stylesheet_url, stylesheet_directory, template_url, pingback_url and more.
copy
Returns path to the child theme directory and the location of the style.css file.
copy
get_post returns an object holding information about the post. By passing an argument you can access object arguments and return the data. Available data - ID, post_author, post_date,post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type and comment_count.
copy
Helper function displaying post's content.
copy
Run the following code to quickly get and display all post meta data.
copy
Lets you load a partial element to a page. If the same partial is provided with a child theme it will override the parent theme file.
copy
The following methods allow for getting and displaying translated text in your theme.
copy
get_the_ID returns am ID of a current item in the loop.
copy
Get theme author declared in the main stylesheet document.
copy
Get template name declared in the main stylesheet document.
copy
Get version of the theme declared in the main stylesheet document.
copy
This method lets you check if post is associated with a specific tag. First attribute expects the tag slug, the second taxonomy slug.
copy
Check if the given page is a 404.
copy
Check if an admin panel or a dashboard is opened.
copy
Check if the admin bar is showing.
copy
Check if the given page is a blog index.
copy
Check if the given page is set to be front page.
copy
Check if the given page is a WordPress page type.
copy
Check if page is using a template.
copy
Check if the given page is a search results page.
copy
Check if the given page is a single blog post type.
copy
Returns page used in the wp-admin area.
copy
Helper function for displaying the post thumbnail. Default Wordpress image sizes - thumbnail|medium|medium_large|large|full. Default WooCommerce image types - shop_thumbnail|shop_catalog|shop_single.
copy
WordPress loop iterates through the_post object allowing you to get the post data.
copy
This function returns a html number pagination in the template. Note, it doesn't work with custom post types.
copy
Lets you register a script in the functions.php file to be called from another part of your site. For example you can register a javascript file for the gallery component and only enqueue it in the page if the gallery component has been used.
copy
Set a global variable as part of the functions.php file.
copy
This filter lets you change compression level when saving and uploading jpeg files. By default compression level is set to 90.
copy
Useful helper function for displaying category title on the archive pages.
copy
Returns the excerpt post content. By default it returns up to 55 words.
copy
Prints a link to a page or a post.
copy
Print post's or page's title.
copy
This handy functions will append a trailing slash to a given string. First it strips all slashes from the end of the url and then adds one to avoid double-slashing.
copy
Get gallery images data array - src [0] - width [1] - height [2] - and if resized [3].
copy