开发者

Not displaying any articles on a custom made file in Wordpress

开发者 https://www.devze.com 2023-04-05 05:34 出处:网络
I have created the file latest.php in the public_html so that when I go to www.domain.com/latest.php it will show me the latest articles. Sadly, nothing of the posts came up. Later, I will sort them w

I have created the file latest.php in the public_html so that when I go to www.domain.com/latest.php it will show me the latest articles. Sadly, nothing of the posts came up. Later, I will sort them with other ways (mostly based on custom fields).

This is my latest.php file (I removed any styling for better understanding)

<?php include("wp-load.php"); ?>
<?php 开发者_Go百科get_header(); ?>
<?php wp_head(); ?>

**AND HERE IS WHAT I COPY-PASTED FROM MY INDEX.PHP THAT IS WORKING**

<?php while (have_posts()) : the_post(); ?>

    <a title="" href="<?php echo get_permalink(); ?>" ><?php the_title(); ?></a>

<?php endwhile; // End the loop ?>

<?php posts_nav_link(' &#183; ', 'previous page', 'next page'); ?>

My question is how can I make it possible to show the latest articles with pagination ? wp-load.php , wp_head and get_header are loaded correctly.

Should I use an entire different method for my task? If yes, which one?


wordpress does not works this way... if you want to make a custom page. create a new template page in the themes folder and then (from back end) create a new page and assign that template to that page.. this way you can put you custom code in the template file and wordpress can process it

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号