Simple Wordpress question - wordpress

I've been programming for like 5 straight hours and my brain has kinda stopped functioning.
I can't remember how to do this:
There is a page called Blog on my website, and I need to show all posts from my blog on that page. The Blog page is using custom template... Therefore, it's not index.php...
Please help me, I'm lost :/

Include loop.php in your template. That is what gets and displays posts.

To show blog post on a custom markup template, you can use this procedure, to loop if there are any posts and print them via the_content function.
<?php
if (have_posts()) :
while (have_posts()) : the_post();
the_content();
endwhile;
endif;
?>

Related

Wordpress page content variable

I am new to wordpress coding but familiar with standard HTML/CSS. With the help of various online tutorials I've finally gotten a good chunk of a simple HTML/CSS website converted to wordpress but Im missing out on some of the basics.
In this case, I am just trying to setup my template to work with the page.php file so that I can create pages through the wordpress admin console. I've figured out how to get the head.php, footer.php, and functions.php working for styles and js files but now I am struggling with what variable I need to place so that the title and content I enter into the page via the wordpress admin appears.
I've tried
1) using a div id=content to my page.php file --that didnt work
2) I've tried adding to my page.php file -- that didnt work
I cant seem to figure it out. Any help would be greatly appreciated. I am a definitley a beginner here so any help is greatly appreciated. Thanks!
This is a very basic template of a page.php in Wordpress.
<?php get_header(); ?>
<div>
<?php
if( have_posts() ) :
while ( have_posts() ) : the_post();
the_title(); // Outputs the title of the page
the_content(); // Outputs the content of the page
endwhile; // End of the loop.
endif;
?>
</div>
<?php get_footer(); ?>
Also, if you would like to store the title and content in php variables first, you can just call get_the_title() and get_the_content()
Please let me know if you are stuck.

Wordpress loop iterates over the last 15 posts only

I'm using a wordpress framework (WooFramework) that uses the following code to create a list of all posts of a specific category:
<?php while ( have_posts() ) { the_post(); ?>
<li><?php the_title(); ?></li>
<?php } ?>
I check the Wordpress documentation and this code seems right. However the list outputted contains only the 15 most recent posts. It seems like something is making the have_posts() stop earlier than it should. Any ideas on what may be causing this problem?
Tip: The index page shows (by default) the 15 most recent posts. Can that be related with the problem? Could it be possible that the framework redefined wordpress' have_posts() function?
Try going to Settings > Reading and changing the value of "Blog Pages Show At Most". If you want to show all your posts you can just set it to something really high like 9999999999.

Wordpress Latest Blog Entries Plugin for Website

I would like to display my blog entries on my website in an iframe or whatever suggested method is. Can somebody please advice how to do that?
Thanks in advance.
Hi,
There are multiple options to do this I am mentioning three of them:
Menthod # 1
You can create a page template in wordpress and than using that page template create a page. Now you have the URL you can use that page in iFrame on any website.
Method # 2
Create a file at the root level of the server with this code:
<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('wp-load.php');
query_posts('showposts=1');
while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p>Read more...</p>
<?php endwhile; ?>
Now you can call this file in the iFrame and you have the latest posts.
Method # 3
You can use the rss feed from wordpress and either use PHP or jQuery to style it.
Thanks
Peachlabs

How do I make a Wordpress Page act like the default home page displaying multiple posts?

I basically want a Wordpress "Page" that acts just like the home page and loops through recent posts and displays them. How do I do this?
If you go to Settings->Reading and then for "Front Page Shows" select static page, and then select a page from the dropdown, then edit the source code for this file to include a standard WP loop like -
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<h2><?php the_title() ?><h2>
<?php endwhile; endif; ?>
Use the wordpress loop, but you can control which posts show up in the loop using query_posts()
http://codex.wordpress.org/Template_Tags/query_posts

Display Posts from a category in Wordpress?

I am trying to display just post title and their links within a set category. However I am running into issues understanding the Codex. Any help or guidance would be greatly appreciated.
I use this a lot in my blogs. Helpful when you want to display featured items or such.
http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters
http://codex.wordpress.org/The_Loop#Style_Posts_From_Some_Category_Differently
You might have seen the above link. I'll explain how it works.
Posts are loaded using the loop. If you do a Query Posts just before the loop, you can choose from select category (or many categories) and also limit the number.
<?php query_posts('cat=1&showposts=5'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><?php the_title(); ?>
<?php the_excerpt() ?>
</li>
<?php endwhile; endif; ?>
You can use the above code as many times you wish. Choose the category ID (can be found from the admin) and the number of posts you wish to show.
Comment - if you require additional help.
It seems that you are working on your templates. It basically means that you need to edit correct template and insert the right tags.
Firstly, you need to understand how the template is chosen. WP has special hierarchy for every view. Home page is usually home.php and categories are category.php or category-1.php. If any file is missing, WP simply takes next on the list. Last on the hierarchy list is index.php which is chosen if no other file is found.
[http://codex.wordpress.org/Template_Hierarchy#Category_display][1]
Secondly, look at the template tags. Displaying only title with link means you need title and permalink tag. Anything else is optional.

Resources