How to create a posts and pages in WordPress

WordPress Structure, Wordpress Tutorials

How to create a posts and pages in WordPress

how to create a posts and pages in WordPress

How to create posts in WordPress

A post is one type of content on any topics and in WordPress all the single content store as a post and WordPress is a most popular for blog posts. That provides the best platform for blogging.

WordPress blog is a collection of posts. There is an easy way to create a new post in WordPress. No need to write any kind of code,  just need to follow few steps.

  • Go to the WordPress admin dashboard.
  • Then after clicking on Posts -> Add New button from left side of WordPress menu panel.

create new post in wordpress

  • Then enter the title of your post in the textbox as per your choice.
  • Enter the content of a post in content editor area and you can also format your contents by using the editor.
  • Then select feature image for the main post from a right side panel and it will be displayed mean feature image for this specific post.

post feature image

  • Select the category for related to this post and also enter the tags suitable for your post.
  • Finally, click on publish to publish your post live. You can save your post as the draft by click on save draft button. also, you can see a preview of your post before it publishes by click on the preview button.

how to create page in wordpress 4

Above steps will create one of the simple posts but also provide categories and tags facility for the post. We can categories particular post by categories and create one of a collection of posts by categories and it will also help to create a hierarchy.

We can also set tags to that particular post so we can also fetch the same type of post using tags that is work same as like Instagram hashtag that will create one group of post related to that particular word.

Now, we have seen one digital mode post creation but WordPress also allows to create posts using WordPress codding we can code for that also and insert post in WordPress when we are creating functionality like import some in WordPress then we need that codding function to insert posts in WordPress.

Below is some sort of code that will help you create posts using WordPress code.

wp_insert_post( array $post_array, bool $wp_error = false )

That function will insert post in that first parameter is post data array that contains all the information about posts below is the description of posts array parameter.

  • post_author: post author parameter is used to define the author of the post so that by will display owner name as post author name. In that field, you have to mention the int value by author id by default its id is the current user id.
  • post_date: In that parameter, you should pass the date of the post in string formate by default that is the current time.
  • post_date_gmt: That is same again post date with GMT time by default is post_date.
  • post_content: In this, you can enter the content of the posts in that you can enter any data type data and by default it is empty.
  • post_title: That contains the post title same as that is by default empty.
  • post_status: That is set the post status publish or a daft. by default, status is the draft.
  • post_type: That will set the post type as WordPress is providing facility to create own custom post type. default post type is ‘Post‘.

Above all is the basic post array parameter WordPress has lots of parameter for a post but that is basically needed for creating on sample post.

The second parameter is $wp_error  That will display error on failure if it is the true default that status is false.

Now below is the one example of to usage WordPress create post function with that parameters.

// set the post data array
$post_arr = array(
'post_title' => 'Helpyouforever test post',
'post_content' => 'This is my test post.',
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 2,25 )
);

// That is function that will insert post in wordpress
$result = wp_insert_post( $post_arr );

That is one sample code to create a post in WordPress programmatically you can use another parameter also as per your need.

That is all about post insert but it is best practice to check every time before inserting any posts in WordPress to check whether that titled match post is already available in WordPress or not. So below is that function will display that post is already available or not.

$title = 'Helpyouforever test post';

if( null == get_page_by_title( $title ) ) {
    // Create the particular post
} else {
    // The page already exists
} // end if

That is all the basic code for creating post in WordPress and that is very useful because when we need to import data from CSV files on that time need to make a functionality or a program that will get the data from CSV files and upload that data in variable after then we can insert that data in WordPress though that code so it’s very simple and easy way to create post in WordPress.

If we are developing a theme in WordPress so that theme contains a lots of dummy pages and post for layout design so whenever we will install the themes on  the theme installation time that theme haveing codding like insert post on that time so after activating that theme we can see lots of posts is in our WordPress that because of that functionality.

If you still having a problem to understand to create a post in WordPress then you can simply comment on that post we will give the best solution in reply.

 

How to create pages in WordPress

The website is a collection of pages. WordPress is a very simple process to create pages. In WordPress all the things about depending on the page. if you create page template then that page template you can use in WordPress page also and this design interface automatically change as per your page template and it is very effective.

We can create pages in WordPress using following steps.

Step 1: In WordPress admin dashboard in left side panel will visible the pages option from their open pages and also manage pages. In main page having one button name is add new click on that button then after then, a new interface will appear for add new page. Below is the screenshot of step one process.

How to create page in wordpress 1

Step 2: After followed step one will see one interface for insert page details in that first text field is for the title in that field we need fillup page title whatever you want (ex. About Us). This will appear in menu whenever we add that page in the menu. The biggest text area is for page content where store all the data about the page.

Step 3: In the third step, we need to set that page attribute as per the requirement below is the explanation of that three of the attribute is default in WordPress.

  • Parent — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Animal” pages under it. There are no limits to how many levels you can nest pages.
  • Template — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this drop-down menu.
  • Order — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.

Also, a one extra features with a page is the featured image. click on set featured image link to upload a new image or select default uploaded image.

Below is the image will display above step 2 and step 3 visualization.

how to create page in wordpress 3

Step 4: This is the final step in that you need to publish that page on click Publish button before publishing you want to preview once that page is okay or not that option also provide by WordPress and one other useful option is that you can draft that page if that is not completed yet or you  want to launch that page after some time like on some date so till that date you can save that in draft so that can only access to only admin no one can access that page.

Below is the picture that will display that all the buttons.

how to create page in wordpress 4

So now we have created a page in WordPress some of the basics options only we can also provide category and tags to that page so that page belongs to that particular category that is a useful feature to create one group of the particular topics related page. We can select categories and tags from the page.

Using this page builder you can do a design of your page in row content and divide in column same as like bootstrap so that will look beautiful in mobile and tablet view.

A WordPress is a content management system so sometimes on the page save time an publish time may but page saving failed and crashed because of network issue in that case if your data will be lost or in other cases if you have changed something in page after polishing you things that do not look good as previous content then WordPress provide most powerful rollback option.

Using that option you revised your previous published data WordPress is maintained the history of your data with time.

Below is the image that will display that option.

How to create page in wordpress 5

 

In image you can see that option for revisions when you will click on browse option then that will display timeline scroller and after that display content of page in two part with difference with different color so you can easily identify what the changes you have made and after change scroller position if you find your previous content then simply you need to click on button restore this autosave that will restore your previous page and now you design layout as it previous.

 

Here you can see the video for how to create posts and pages in WordPress

3 thoughts on “How to create a posts and pages in WordPress

  1. I really wanted to type a brief comment to be able to thank you for those superb guidelines you are placing on this site. My considerable internet search has finally been rewarded with good details to exchange with my classmates and friends. I ‘d declare that many of us site visitors actually are extremely fortunate to be in a magnificent website with many awesome professionals with great plans. I feel pretty lucky to have seen your entire web site and look forward to plenty of more thrilling minutes reading here. Thanks a lot again for a lot of things.

  2. Hey! I know this is kinda off topic but I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa? My site covers a lot of the same subjects as yours and I think we could greatly benefit from each other. If you’re interested feel free to send me an e-mail. I look forward to hearing from you! Fantastic blog by the way!

Leave a Reply