php - wordpress custom page post query -


i have problem because database have table stores post data. need data table , show on register_post_type.

function duonampost() {      $labels = array(         'name'                => _x( 'nam', 'post type general name', 'duonampost' ),         'singular_name'       => _x( 'nam', 'post type singular name', 'duonampost' ),         'menu_name'           => __( 'nam', 'duonampost' ),         'name_admin_bar'      => __( 'nam', 'duonampost' ),         'parent_item_colon'   => __( 'parent item:', 'duonampost' ),         'all_items'           => __( 'all items', 'duonampost' ),         'add_new_item'        => __( 'add new item', 'duonampost' ),         'add_new'             => __( 'add new', 'duonampost' ),         'new_item'            => __( 'new item', 'duonampost' ),         'edit_item'           => __( 'edit item', 'duonampost' ),         'update_item'         => __( 'update item', 'duonampost' ),         'view_item'           => __( 'view item', 'duonampost' ),         'search_items'        => __( 'search item', 'duonampost' ),         'not_found'           => __( 'not found', 'duonampost' ),         'not_found_in_trash'  => __( 'not found in trash', 'duonampost' ),     );     $args = array(         'label'               => __( 'nam', 'duonampost' ),         'description'         => __( 'duo nam plugin', 'duonampost' ),         'labels'              => $labels,         'supports'            => array( ),         'taxonomies'          => array( 'nam_tax' ),         'hierarchical'        => true,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'menu_position'       => 5,         'show_in_admin_bar'   => true,         'show_in_nav_menus'   => true,         'can_export'          => true,         'has_archive'         => true,               'exclude_from_search' => true,         'publicly_queryable'  => true,         'query_var'           => 'nam_query',         'capability_type'     => 'page',     );     register_post_type( 'nam', $args );  } add_action( 'init', 'duonampost'); 

on code link shows this: http://localhost/wp/nam/pageopen

and "pageopen" value needs retrieve database , display.

my table name wp_duonam , when open link http://localhost/wp/nam/pageopen query must "select * wp_duonam link = pageopen;

<?php  // query $the_query = new wp_query(  array( 'post_type' => 'nam' ) ); ?>  <?php if ( $the_query->have_posts() ) : ?>      <!-- pagination here -->      <!-- loop -->     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>         <h2><?php the_title(); ?></h2>     <?php endwhile; ?>     <!-- end of loop -->      <!-- pagination here -->      <?php wp_reset_postdata(); ?>  <?php else : ?>     <p><?php _e( 'sorry, no posts matched criteria.' ); ?></p> <?php endif; ?> 


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -