E
E
e5ash2017-05-25 20:42:57
CMS
e5ash, 2017-05-25 20:42:57

How to display Custom Post Type UI news?

Hello.
Faced a problem with displaying news in page.php
Initialized in functions.php and then went into a stupor.
Please help, thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
e5ash, 2017-11-03
@e5ash

Answer:
1. Copy everything from the "/wp-admin/admin.php?page=cptui_tools&action=get_code" page from the "All CPT UI Post Types" field.
2. Paste into the current theme's functions.php file
3. Paste the current code into the output page: where 'post_type' is the 'slug' you specified when creating the post type.
<?php $loop = new WP_Query( array( 'post_type' => '', 'posts_per_page' => 0 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php endwhile; ?>
<?php wp_reset_query();?>

W
WordPress WooCommerce, 2017-05-25
@maxxannik

First, learn how to output something through shortcodes. Before touching page.php This is a template that should only be touched if you understand what you are doing well.
Make shortcode add_shortcode. Paste it into any page. First print something like Hello World. Then learn to display something like news.
It is not clear how the news is related to Custom Post Type UI. Usually, for news, a typical post section is used - a blog. Making news via CPT UI is very strange.
In general, there is a suspicion that you went somewhere in the wrong place. It is probably necessary to roll back a step - to describe the problem as a whole. Then choose more suitable solutions. And only then look for ways to implement.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question