nickbudden
Forum Replies Created
-
Forum: Plugins
In reply to: [WordPress MU Domain Mapping] Don't Redirect Admin AjaxHere is a function to do this without breaking admin-ajax
function my_admin_init(){
if( !defined(‘DOING_AJAX’) && !current_user_can(‘administrator’) ){
wp_redirect( home_url() );
exit();
}
}
add_action(‘admin_init’,’my_admin_init’);This function was provided by Milo on Stack Overflow.
Forum: Plugins
In reply to: [WordPress MU Domain Mapping] Don't Redirect Admin Ajax+ 1 from me too…I’m also working on this now. Here is something I tried (which does not work):
add_action( ‘init’, ‘noadmin_redirect’ );
function noadmin_redirect() {
$admin_ajax = “wp-admin/admin-ajax.php”;
if( true == is_admin() && ($_SERVER[‘REQUEST_URI’] != $admin_ajax )) {
if( !current_user_can(‘administrator’) ) {
wp_redirect( get_bloginfo(‘url’) ); exit();
}
}
}Forum: Plugins
In reply to: Vote it Up – Post OrderAny ideas on getting pagination working?
Forum: Plugins
In reply to: Vote it Up – Post OrderI apologize to anyone subscribed to this thread by email for the multiple posts…but the following also needs to be included here. In you are having duplicate posts, you need to add a GROUP BY to your query. For example I am using…
$query = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wposts.post_status = 'publish' AND wposts.post_type = 'YOUR_POST_TYPE' GROUP BY wposts.ID ";Adding the GROUP BY causes the loop to automatically exclude any duplicate posts. Hope this helps someone.
Forum: Plugins
In reply to: Vote it Up – Post OrderSorry…nevermind my question, figured it out as well. In case anyone has trouble with this I’ll explain a few things you need to change in the given example, and a thanks to vertaxe for sharing.
1. ‘yourkey’ and ‘yourvalue’ are examples added to the query in case you decide to querya custom field…they are not required to query by your votes. Pretty much everything in the following code can be customized to your own query….which was explained already, but I didn’t really get so am re-sharing.
$query = " SELECT wposts.* FROM wp_posts wposts, wp_postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'yourkey' AND wpostmeta.meta_value = 'yourvalue' AND wposts.post_status = 'publish' AND wposts.post_type = 'yourtype' ORDER BY wposts.post_date DESC ";2. Watch for the include. Here, you’ll have to include your own loop. Again pretty simple but for some reason I looked over this as well the first time through.
$pageposts = ShowPostByVotes($query); if ($pageposts): foreach ($pageposts as $post): setup_postdata($post); // loop content goes here include 'yourloopcontent.php'; endforeach; endif;Forum: Plugins
In reply to: Vote it Up – Post OrderSorry but…what was ‘yourkey’ and ‘yourvalue’ after all?
Forum: Themes and Templates
In reply to: Query Posts by Popularity?Thanks Nalin, might be able to tweak that to query what I need.
Hi,
I’m not sure if it will or will not make a difference, but if you check the codex a page named “Snarfer” should have the file name “snarfer.php”.
http://codex.ww.wp.xz.cn/Pages#Page_Templates
Try renaming your file to “blog.php” and see if that works.
Forum: Fixing WordPress
In reply to: File PermissionsHi,
Thanks a lot for the reply! The site is for a friend and their host is a friend of theirs who probably wouldn’t know what to do about the permissions, but the biggest problem was the 404’s on the page and you were right, switching the permalinks back fixed the problem 😉
I’m sure I can ftp my way through the theme editing/plugins!
Forum: Themes and Templates
In reply to: end of category.php producing 404 errorIf anyone runs into this same problem set your posts per page to 0, and check out this thread: http://ww.wp.xz.cn/support/topic/fix-for-the-previousnext-entry-link-problem?replies=1
Forum: Themes and Templates
In reply to: custom_post_type category templates?Would there be a certain template file for this that I haven’t found? Maybe something along the lines of [my_post_type]-category.php?
Thanks again for any help!
Forum: Themes and Templates
In reply to: end of category.php producing 404 errorHi, sorry for the delay but finally got a change to test it out. If I remove the query and set the posts per page via admin settings it works fine, and if i put the query back in there while disabling my custom permalinks it also works fine.
Any suggestions on how to incorporate this along with my custom permalinks? I’ve really got my heart set on them.
Forum: Themes and Templates
In reply to: end of category.php producing 404 errorThanks, but no luck, it is still producing a 404. Would there be another way to limit posts per page? Or another way to have multiple loops on a category page, i.e. without using wp_reset_query (which I assume breaks the category)
Forum: Themes and Templates
In reply to: end of category.php producing 404 errorYes it uses the following query that I got off these forums. I use it to limit the number of posts per page for different categories:
<?php if (is_category('CATEGORY-NAME')) { $posts = query_posts($query_string . '&orderby=date&showposts=3'); } ?>Forum: Themes and Templates
In reply to: Random Posts is Duplicating ThumbnailsWould this technique be incompatible with thumbnails?