rwatkins
Forum Replies Created
-
Forum: Your WordPress
In reply to: comments linkHey,
How did it go?
It seems that The Loop I posted for “index.php” is the old one (from WordPress 1.2). It still seems to work (it was what I was using!) but in actual fact the loop syntax is the same for both single.php and index.php:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
post content here
(maybe your comments_template() call here!)
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>Rob
Forum: Fixing WordPress
In reply to: Displaying the latest wordpress entries on my main pageHey,
You need to look up the mysql limit syntax:
.... LIMIT base, number
where
base
is the record you want to start at, andnumber
is the number of records you want to pull out the database. So to take the first three records, you want (I think)LIMIT 1, 3
.There are much nicer ways of pulling out ‘n’ records from the database than connecting to it directly yourself. If you include the WordPress files into your home page php (see here for info on how to do that), you can then take on all the functionality of WordPress. Then you can use the main post loop and just include a variable that restricts the number of posts to display.
Something a bit like this:
<?php $i = 0; if ( have_posts() ) : while ( have_posts() && $i < 3 ) : the_post(); ?>
stuff to do with the posts
<?php $i++; endwhile; endif; ?>
Then you can use all the wordpress template tags instead :).
Rob
Forum: Plugins
In reply to: Weather Report and a sleepless idiotHey,
You will have to edit the weather-report.php file (as per the installation instructions).
Where it says
define ('WP_DIR', '/path-to-your-wp-directory/');
make sure you have the full path to your directory. This is
/home/omar/public_html/bullspeak/
(looking at what you have posted above). You probably just have/bullspeak/
which is pointing to a completely different directory.Rob
Forum: Fixing WordPress
In reply to: How to hide posts from 2 or 3 categories from index pageHey,
You could use && (which means ‘and’) inside the if-statement:
<?php if ( !(in_category('8')) && !(in_category('7')) && !(in_category('9'))) { ?>
Therefore the post will only be displayed, if it’s not in category 8 and if it’s not in category 7 and if it’s not in category 9.
Note that this will more than likely remove posts that are posted in multiple categories but one of the categories is one you want to filter.
You could probably do this using a hook from the Plugin API but I have to admit I’m not too sure how.
Rob
Forum: Fixing WordPress
In reply to: Non WordPress controlled page…Hey,
A WP page *should* work, but if you want to create a completely seperate page (writing the PHP yourself) that lives outside WP but accesses WPs functionality then there’s a good thread here.
Before creating your own, what was the problem that you had with pages? It’s probably easier to remedy that (plus you can update using the admin area) than to create your own page from scratch.
Rob
Forum: Fixing WordPress
In reply to: HTTPS certificate problems: How to change blog URL to http?Hey,
I think you can do this by editing the two options – WordPress address and Blog Address inside your admin control panel (go to options). If you can’t access the admin control panel then you will have to do it via the database using PhpMyAdmin and the like. There’s a tutorial on how to do this here.
Rob
Forum: Your WordPress
In reply to: comments linkHey,
You need to add
<?php comments_template(); ?>
(note the s) into a file – you are correct :). However you can either add it to your index.php (main template) or create a single.php (the post template) which is used when a single post is displayed.To add to your index.php, follow the below. However…I’m not sure if it still works. I think it does, but if it doesn’t…have a go at what I detail underneath this!
Inside your index.php (the “main template”) and after your post content (i.e. where you print out the post text, the number of comments, date and time, stuff like that), add in the
comments_template()
tag. When you are viewing a single post, WordPress will include the comments list and form; when you are viewing multiple posts (like you do on the front page of your site) it isn’t included.If this doesn’t work then you will have to create your own single.php template. See below for my guide on how to do this.
To create your own single.php (the post template):
Create a *new* file, called “single.php” inside your theme directory. This is the template used when you are viewing a single post (and therefore the one you want comments on). You can pretty much copy your “index.php” into this file, as that’s the layout you want the page to have.
After you have done this, on the part of the page where you want the comments to be displayed, you need to add
<?php comments_template(); ?>
– this will display the comments form and list as defined in “comments.php”. Normally you’d have this after the post and so after the post-specific stuff (like where you have the template tagthe_content()
) you would add thecomments_template
tag.There are a few differences between the single.php and index.php templates – mainly that the index.php displays a list of posts whereas single.php lists just a single one. Have a look at the default template’s “single.php” for how you modify the main loop, but for mine the only difference is thus:
The main template (index.php) has a loop of
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
post content here
<?php endforeach; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>The single page template (single.php) has a loop of
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
post content here
<?php comments_template(); ?>
<?php endwhile; endif; ?>“Post content here” is probably the same for both – i’ve add in where I have my comments_template() call too.
**********
Rob
Forum: Your WordPress
In reply to: comments linkHey,
Looks like you might be missing the line
<?php comments_template(); ?>
(see here for a description) from the “post” template.Rob
Forum: Themes and Templates
In reply to: How to communicate between different parts of a blog?Hey,
I think it looks like you want to list the categories of your blog on on your horizontal navigation bar, yeah? So people can click the links and be shown the post from a certain category?
If you want to do that, you need to edit your templates and use the list_cats() or wp_list_cats() template tags.
The folder structure is done automatically by wordpress (if you have the permalink structure enabled). Using one of the template tags will display a list of the categories with clickable links that, when clicked, show just the posts in that category — that is all you have to do. There is no need to create new folders :).
Think that is what you mean anyway!
Rob
Forum: Fixing WordPress
In reply to: PHP include Template path.Hey,
Apologies for the code. That was seriously bad – I should have re-read it!
With a 404.php inside my templates directory and the following inside my error_404.php
<?php /* we have to have this to make TEMPLATEPATH
point to the correct location */
require('wp-blog-header.php');
/* load up header2.php from the current template directory */
include (TEMPLATEPATH . '/404.php');
?>(thought it would be better to re-paste something that actually works ;)) then I see the contents of 404.php should I go to the error_404.php script in my wordpress root directory.
Just check that it wasn’t my (really) shoddy code that made you go wrong ;).
If that doesn’t work… I have to admit I’m not completely sure. Try adding
error_reporting(E_ALL);
to the top of error_4o4.php and see if PHP gives you any errors.Forum: Fixing WordPress
In reply to: PHP include Template path.Hey,
You should be starting over with a new script in your root directory (called error_404.php – it doesn’t already exist does it?). In that you want to put something like :
<?php /* we have to have this to make TEMPLATEPATH
point to the correct location */
require('wp-blog-header.php');
/* load up header2.php from the current template directory */
<?php include (TEMPLATEPATH . '/header2.php'); ?>
/*
?>If you want to get that loaded up when a 404 error occurs, you need to modify your .htaccess in the root directory. You might want to look at the Apache documentation for the ErrorDocument command but you would have to add something like:
ErrorDocument 404 /error_404.php
If you are still confused don’t hesitate to reply.
Rob.
Forum: Fixing WordPress
In reply to: PHP include Template path.Hey,
I think it would be possible although you’d have to include
wp-blog-header.php
in the PHP that you are using so that it can use all the WordPress functions in it (and be able to use TEMPLATEPATH).You should then be able to do what you want.
Rob
Forum: Fixing WordPress
In reply to: call to undefined funtion, after index.php mod…Hey.
It looks like you might be editing a theme’s index.php (inside the wp-content/themes directory) and then accessing the page directly (by browsing to https://www.yourdomain.tld/wp-content/themes/mytheme/index.php). [as said above!]
Instead, after editing the index.php for a theme you need to either select that theme in the admin control panel (under Presentation) or, if the theme is already selected, just visit your weblog (without the /wp-content and stuff on the URL) and you should see the updated display.
Rob.
Forum: Your WordPress
In reply to: A blog about a little bit of everything…I like it too. Nice simple design that is uncluttered. Good job!
Rob.
Forum: Themes and Templates
In reply to: Comments template in WP 1.5Hey there.
The problem seems to be your HTML not working that nicely in FireFox (causing it to do something kind-of weird!). I tried submitting the form in Internet Explorer and it worked perfectly!
You will need to look at your HTML. Have a go at getting it to validate using the w3c HTML validator (might take a little bit of work) and you will most likely find that it starts working!
Definitely looks to be more of a web design problem rather than a WordPress one, however.
Rob