You can easily code this in your header.php file and it will work fine but it’s not a good practice to do so. A better option is to use the functions and hooks provided by WordPress. You can add the following code to your functions.php file
Large number of websites on internet these days is made on WordPress which has also become one of the most popular content management system (CMS). With the growing use and popularity of WordPress the need for its security has also increased and to look into this matter various security plugins are provided. Though there are large numbers of these security plugins but the details of the most popular ones are given in the following part of the article.
Explore more infographics like this one on the web’s largest information design community – Visually.
As per Wikipedia, Pagination is the sequence of numbers assigned to pages in a book or periodical.
In WordPress, we generally use WP_Query or query_posts to fetch posts and display the list with pagination. A simple query would look like this:
This will work just fine in most of the cases but sometimes we hear issues that the pagination is not working properly or pagination numbers are correct but every page shows the same list. It’s mostly because we haven’t included the ‘paged‘ parameter to the query. The following is taken from WordPress Codex.
Since the the release of WordPress 2.5 Shortcodes have been really popular and developers and user love it. Shortcodes have been extensively used to create a visually good looking content in WordPress.
Basically Shortcodes converts multiple lines of codes that performs specific task to a small WordPress specific code. Shortcodes looks like this [shortcode] or if wrapped with contents may look like [shortcode] Some Content Here [/shortcode].
Shortcodes have been used for multiple purposes like
displaying recent posts
Creating multiple columns
Create a blockquote
Create tabs and accordions
Display Twitter Feed, Etc and many more.
So why this article? Is Shortcode Bad?
No, Shortcodes are really useful and it has brought many easy solutions for developers and users. But, if shortcodes are setup directly in theme, then it might create problem in future. This is because when we implement shortcodes in a theme directly, it becomes available to that particular theme only. If we change to another theme then all of the shortcodes will be unavailable and all we will be left is texts and visually it will look really bad. All the styles that came with shortcodes will be gone, if you had setup tabs and accordions will be gone. if you were displaying recent posts, you will only get something like this [recent-posts].
When creating shortcodes we should keep in mind all the factors that might affect the site if we use the shortcode. The best solution of this would be creating a separate plugin for the shortcodes with all the necessary styles and functions. This will make the shortcode independent of the theme and easily be run and implemented without hampering the site’s look even if the theme is changed.
WordPress has proved to be one of the best platform for Developers and it provides a complete package for building a full Website. But sometimes we developers may need to add one or more custom PHP pages for various reasons.
Suppose you have a template file for your contact page and you built a custom form which when submitted will direct to send-contact-mail.php file and then that file will be used for form data manipulation and send mail. Here, you can easily use the php mail() function easily and achieve your goal but what if you want to use the WordPress actions in the file?
By default, your send-contact-mail.php is not recognized by WordPress and you cannot use any of the WordPress functions like get_bloginfo(‘url’); or in our case wp_mail(); function.
So What Do We Do?
The solution is quite easy. All we need is to include the wp-load.php file in our custom php page. The wp-load.php is location in the root of the site and it will make your custom php file compatible with WordPress functions.
However, there are many critics on including wp-load.php file. When you don’t know where the wp-load.php file is, it creates problem when including the file.