php - How to show two different categories in wordpress? -


actually i've static website , i'm trying convert wordpress, i'm new wordpress. have created following page.

header.php footer.php sidebar.php functions.php index.php

then have created main-template.php page other pages about, contact, gallery, etc, using same template. website completed 2 pages left.

1. jobs

2. news & events

so in these pages, there new jobs coming, , same news & events. think these 2 pages blog post.

jobs page display jobs title , 100 words description , read more button, open in new page particular job.

i have different job categories electrician, plumber,mason,english language,call center etc

i want show categories jobs on jobs page.

so have created page in wp-admin>pages>add new called jobs , newsevents , selected template main-template have used pages. page blog type show jobs.

as know having 2 blog type pages 1 jobs , 1 news events have created 2 categories jobs & newsevents

now if add new job, go wp-admin>posts>add new add title, description, select category job if job, newsevents.

so question how show jobs on jobs page , newsevents on newsevents page?

how create single.php?

how many single.php have create?

i have created `single.php` <?php /**  * template displaying jobs  */ /*get_header();*/ get_header(); ?> <?php  while ( have_posts() ) : the_post();     get_template_part( 'content', 'jobs' ); endwhile; ?> <?php get_footer(); ?> 

and have created empty jobs page in wp-admin>pages>job link localhost/myproject/jobs want show jobs on page, jobs post..

i have created content-jobs.php page too, should next? how show jobs? my content-jobs.php

    <?php the_content() ?> 

i have read wordpress documentation unable understand properly, first time doing it, me?

1) need create separate template these pages. 2) create pages 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 code in function.php

after post data in post type , show on front end in 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 you


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -