Create a page for each database custom table entries

[ad_1]

You could create a page which uses a custom template. Lacking more specific information, it’d query the table and output links and abridged information corresponding to each row. Essentially an archive listing of all relevant rows.

The links could include an URL query string that specifies a specific row. When such information appears in a link, instead of listing all rows, the template code queries for just that one row and outputs complete information for that one row.

For example, this would list all offers with links:

This would display all information for one specific row:

I resolve the problem. What have i done ?

  • Create and register my custom post type, create a template for it.
  • Create a small code that creates a post for each of my jobOffers with these fields: wp_insert_post([ 'post_content' => $jobOffer->description, 'post_title' => $jobOffer->label, 'post_excerpt' => substr($jobOffer->description, 75), 'post_type' => 'phenix_job_offer', post_name' => sanitize_title($jobOffer->label), 'meta_input' => ['job_offer' => $jobOfferId] ]);
  • After that in my template i fetch the jobOffer with the post meta key ‘job_offer’ then render it as i want.
  • This reply was modified 5 minutes ago by asmitta.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer