wp_guy
Forum Replies Created
-
Forum: Plugins
In reply to: Question About A Random Post PluginJust noticed the ‘read more…’ link isn’t right for some reason…
Forum: Plugins
In reply to: Question About A Random Post PluginAah! my bad… I hadn’t actually tried the code.
Here’s the good one:
<?php $random_post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE post_status = 'publish' AND post_type='post' ORDER BY RAND() LIMIT 1"); setup_postdata($random_post); the_content("Read More..."); ?>
That one will work fine and show the excerpt (if you use the <!–more–> tag).
Forum: Plugins
In reply to: Question About A Random Post PluginI guess you could do a custom database call, like so:
<?php $random_post = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'publish' AND post_type='post' ORDER BY RAND() LIMIT 1"); echo $random_post->post_content; echo '<br />'; echo '<a href="'.$random_post->guid.'">Read More...</a>'; ?>
That would echo the whole post content, not just the excerpt… I’m not sure how to get the excerpt right now… anyone?
Try:
<?php query_posts($query_string); ?>
and then the regular loop.
Good luck!
Forum: Themes and Templates
In reply to: Themes for virtual multi-blogging?If I understand what you’re asking… Yes, you probably need a specific kind of theme for that, or some custom modifications made to the theme of your choice.
The basic idea would be to use different categories for each project. Then have a menu with links to those categories (e.g. yourblog.com/category/e-books). And maybe modify the archives so it all works properly.
Hope that helps!
Forum: Themes and Templates
In reply to: Small Header / .css help // page link list //Or maybe you’ve made it too narrow…
Setting the #topleft width to 330px seems to fix it for me anyway.
Forum: Themes and Templates
In reply to: Small Header / .css help // page link list //You need to make the #topleft element narrower:
#topleft { float: right; height: 106px; width: 330px; }
Forum: Themes and Templates
In reply to: how to check if a post is the newest postYou can add the following code to your index.php (outside the loop):
<?php $post_number = 0; ?>
Then this code inside the loop:
<?php $post_number++; ?>
The first piece of code declares the variable $post_number and sets it’s value to 0. The second runs every time a post is echoed and ads 1 to the $post_number variable.
Now you can use the following if statement:
<?php if ( $post_number == 1 ) : ?> Your adsense code here <?php endif; ?>
Hope that helps!
Forum: Themes and Templates
In reply to: Problem with adding widgetsHere’s an article on how to enable widgets in your template:
Forum: Themes and Templates
In reply to: Need to find a similar/clone theme – Please help.Those two sites seem to use custom made themes.
I don’t know of any similar themes, but you can start by looking here: https://themes.wordpress.net
Forum: Themes and Templates
In reply to: Error, please helpApparently, kiwi-lite is some kind of special WordPress theme that needs the Canvas Plugin to be installed in order to work.
The plugin can be downloaded here:
https://www.freshpursuits.com/canvas/downloadGood luck!
Forum: Themes and Templates
In reply to: Urgent. What files are called with get_sidebar();Can you post a link to the actual pages? it’s kinda difficult to see what’s wrong just looking at the CSS code.
Forum: Themes and Templates
In reply to: display cats and archive on blog onlyYep, you can use the is_page() conditional tag, as long as your sidebar isn’t widgetized. Otherwise you’d need to create 2 sidebars (one for your blog and one for the pages).
Forum: Themes and Templates
In reply to: make parent pages and categories not clickableYou’d need to write a custom PHP code for each one of those, instead of using the built-in wp_list_pages() and wp_list_categories() template tags, since those two don’t have that option.
Have a look at the get_pages() and get_categories() functions. They’re used to return an Array with all your pages and categories.
You’ll need some PHP knowledge though.
Forum: Plugins
In reply to: Popularity Contest without pages?In response to your first question, you can show only posts by editing the popularity-contest.php file. Around the line 1377 there’s the following MySQL query:
$posts = $wpdb->get_results(" SELECT ID, post_title FROM $wpdb->posts LEFT JOIN $wpdb->ak_popularity pop ON $wpdb->posts.ID = pop.post_id $join WHERE post_status = 'publish' AND post_date < NOW() $where $groupby ORDER BY pop.total DESC LIMIT ".intval($limit) );
That needs to be replaced by the following:
$posts = $wpdb->get_results(" SELECT ID, post_title FROM $wpdb->posts LEFT JOIN $wpdb->ak_popularity pop ON $wpdb->posts.ID = pop.post_id $join WHERE post_status = 'publish' AND post_date < NOW() AND post_type = 'post' $where $groupby ORDER BY pop.total DESC LIMIT ".intval($limit) );
The key here being the “AND post_type = ‘post'” bit which tells the plugin to look just for posts and not pages.
That’ll make the akpc_most_popular(); function show only posts, and not pages.
As for your second question… again, you’ll have to edit the plugin file around the line 1651. Changing this:
if (is_feed() || is_admin_page() || get_post_meta($post->ID, 'hide_popularity', true) || !$show) {
for this:
if (is_feed() || is_admin_page() || get_post_meta($post->ID, 'hide_popularity', true) || !$show || is_page()) {
The key being “|| is_page()” which prevents the popularity to appear on pages. They will still appear on posts though.
Hope that helps!