Actually i've a static website and i'm trying to convert it into wordpress, i'm new to wordpress. I have successfully created following page.
header.php
footer.php
sidebar.php
functions.php
index.php
Then i have created a main-template.php
page for my other pages like about, contact, gallery, etc, They will all be using same template. The website is almost completed but only two pages are left.
1. Jobs
2. News & Events
So in these pages, There will be new jobs coming, and same for news & events. So i think these two pages will be like a blog post.
Jobs page will display all the jobs with title and 100 words description and read more button, Then it will open in new page for that particular job.
I have will different job categories like electrician
, plumber
, mason
, english language
, call center
etc
I want to show all categories jobs on Jobs page.
So I have created a Page in wp-admin>pages>add new
called Jobs
and newsEvents
and selected template main-template
that i have used for all pages. But this page will be blog type to show all jobs.
As you know I will be having two blog type pages one for JObs and one for News Events So I have only created two categories Jobs
& NewsEvents
Now If i add a new job, I will go to wp-admin>posts>add New
then add title, description, select category Job if it is job, similarly for newsevents.
So the question is How do i show jobs on jobs page and newsevents on newsevents page?
How to create single.php?
How many single.php do i have to create?
I have created `single.php`
<?php
/**
* The template for displaying Jobs
*/
/*get_header();*/
get_header();
?>
<?php
while ( have_posts() ) : the_post();
get_template_part( 'content', 'Jobs' );
endwhile;
?>
<?php
get_footer();
?>
and I have created Empty jobs page in wp-admin>pages>Job its link is localhost/MyProject/jobs
I want to show jobs on this page, all jobs that i will post..
I have created content-jobs.php
page too, Now what should i do next? how will i show jobs? my content-jobs.php
<?php the_content() ?>
I have already read wordpress documentation but unable to understand properly, this is my first time doing it, Help me?
1) you need create separate template for these pages. 2) Create the pages with receptive names 3) Use these templates on these pages in admin 4) Create custom post type News& Events
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'News',
array(
'labels' => array(
'name' => __( 'News' ),
'singular_name' => __( 'News' )
),
'public' => true,
'has_archive' => true,
)
);
}
add this code in function.php
after that post some data in this post type and to show this on front end in your template file use.
$args = array( 'post_type' => 'News', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile;
use this it will help you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.