eckul
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Count all posts on site from two categoriesNot too worry I fixed it by adding ‘posts_per_page’ => -1
` $posts = query_posts(
array( ‘category__and’ => array(10,23),’posts_per_page’ => -1));$stkneg2 = count($posts);`
Forum: Fixing WordPress
In reply to: older posts link not workingHi thanks for all your help I’ve managed to fix this by changing the main page back to index.php (instead of a static page) and using
<?php query_posts($query_string."&showposts=7") ?>
I also changed the posts per page to 7 in the reading settings. I didn’t really want to have to index.php as my main page but I guess I’ll just work around it as I’m now better off then I was before. Not too sure why it’s now working but I’ll go with it. Cheers
Forum: Fixing WordPress
In reply to: older posts link not workingthanks for your help, but that didn’t work it went to /page/2/ but just reloaded the same posts from page 1. So it’s no longer loading the posts from page 2, which is was doing with the previous code.
Forum: Fixing WordPress
In reply to: older posts link not workingno worries please see below.
<?php /** * Template Name: Full Ladder * * A custom page template for blog page. * * The "Template Name:" bit above allows this to be selectable * from a dropdown menu on the edit page screen. * * @package WordPress */ get_header(); ?> <div id="content" role="main"> <div class = "ladderMajor"> <?php include 'ladders/full-ladder.php';?> </div> <div id ="skinny-blog"> <p class = "recent-articles"><strong>ARTICLES</strong></p> <?php query_posts($query_string."&showposts=7") ?> <?php if ( have_posts() ) : twentyeleven_content_nav( 'nav-above' ); while ( have_posts() ) : the_post(); get_template_part( 'content', get_post_format() ); endwhile; twentyeleven_content_nav( 'nav-below' ); else : ?> <article id="post-0" class="post no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1> </header><!-- .entry-header --> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </article><!-- #post-0 --> <?php endif; ?> </div><!-- #skinny-blog --> <?php get_footer(); ?>
Forum: Fixing WordPress
In reply to: older posts link not workingI’ve managed to get the older posts link to work by setting the posts per page to 1000. I then limited the posts per page in the page template. But now it only goes back to /page/2/ and just reloads the same page when I try to go back further. the url for /page/3/ is working but I just can’t get it to work via the older posts link. any help would be great thanks.
Forum: Fixing WordPress
In reply to: display and count posts from last 7 daysthanks got it, see below. Cheers
$week = date('W'); $week = date('W'); $posts = query_posts( array( 'category__and' => array(6,15), 'w'=> $week, )); $ricpos = count($posts);
Forum: Hacks
In reply to: Counting post and displaying resultThanks, I tried but couldn’t get it to work. But it helped me find a solution. I’ve used the below code. I’m sure it’s not the right way to do it, but it’s working well. cheers
$posts = query_posts( array( 'category__not_in' => array( ) ) ); $allpos = count($posts);
Forum: Fixing WordPress
In reply to: echoing entire page content including all posts from that page.I’ve managed to get it working by putting royal slider in a page template and posting the below code into the slider. I haven’t done a lot of testing yet but seems to be fine at this stage. Could be a messy way of doing it, but the only solution I’ve found so far.
<?php
$custom = get_post_custom( get_the_ID() );
$cat = ( isset($custom[‘ts_blog_category’][0]) )? $custom[‘ts_blog_category’][0] : “”;
global $more; $more = 0; $post;
$args = array(
‘post_type’ => ‘post’,
‘paged’ => $paged
);
if($cat!=””){
$args[‘cat’] = $cat;
}query_posts( ‘cat=2’ );
rewind_posts();
get_template_part( ‘loop’, ‘archive’ );
wp_reset_query();
?>Forum: Fixing WordPress
In reply to: echoing entire page content including all posts from that page.Hi, I’m using a theme called Twins which I downloaded from theme forest it’s by template square, it’s a really good theme, I’ve been customizing a bit . Do you think it’s theme related issue? maybe I should contact their support?
Forum: Fixing WordPress
In reply to: echoing entire page content including all posts from that page.Hi, I don’t think it has anything to do with the theme or a plugin. I basically just want to get a page and place it’s content within a template file, So everytime I use that template it will include that pages information. There is probably a better way of doing it. It just wont grab a page that has posts for some reason. Do I need to add get_posts or something similar to my php? I can’t seem to find the answer.
Forum: Hacks
In reply to: executing a mysql query on publishing of postthank you I think I’m almost there. Cheers
Forum: Hacks
In reply to: executing a mysql query on publishing of postThanks for your help. I’m still having some problems though. I’ve put the below code into the functions.php file. I’m trying to run the query when I make a post with both categories 2 and 3 selected. But it’s now breaking wordpress and not working. Do you know what I’m doing wrong? I’m pretty new to this stuff aren’t very familar with if statements. any further help would be amazing.
function add_point( $query ) {
if ( $post_categories = array( ‘category__and’=>array(2,3) )) {
mysqli_query($con,”UPDATE persons SET Age=Age+1
WHERE FirstName=’Peter’ AND LastName=’Griffin'”);
}
}add_action( ‘draft_to_publish’, ‘add_point’ );
Forum: Hacks
In reply to: executing a mysql query on publishing of postthank you I’ll give it a go