stiwdio
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Permalink problemYeah nothing happened;
Ive read that it might not be possible on a Windows server? think they are using Helm?
Forum: Hacks
In reply to: selected pages navigation – not postsThanks for the advice – its a bit of a tricky one 🙂
But really appreciate the advice!
Forum: Plugins
In reply to: create a list of posts with top 4 featuredI have this code so far;
I have two questions, how to I add a featured image to the first loop;
and how do i exclude the posts in the first loop in the second?Is this possible?
Cheers<?php // WP_Query arguments $args = array ( 'pagination' => true, 'ignore_sticky_posts' => false, 'order' => 'DESC', 'orderby' => 'date', 'category__in' => array(4), ); // The Query $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); echo '<div class="cats">'; echo '<h1><a href="'.get_permalink( $post->ID).'">' . get_the_title() . '</a> </h1>'; echo '<h2>' . get_the_excerpt() . '</h2></div>'; } } else { // no posts found } // Restore original Post Data wp_reset_postdata(); ?> <?php // WP_Query arguments $args = array ( 'pagination' => true, 'posts_per_page' => '10', 'ignore_sticky_posts' => false, 'order' => 'DESC', 'orderby' => 'date', 'category__in' => array(4), ); // The Query $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); echo '<h1><a href="'.get_permalink( $post->ID).'">' . get_the_title() . '</a> </h1>'; } } else { // no posts found } // Restore original Post Data wp_reset_postdata(); ?>think I fixed it esmi, just a few rouge ‘ ‘ thank you for all your help and teaching me also 🙂
Darren
it just says this;
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/stiwocom/domains/stiwdio.com/public_html/stiwdio/wp-content/themes/Stiwdio/single.php on line 20
Hi esmi
Thanks for that; Ive added that;<?php /** * Single Post Template - this is the template for the single blog post. */ get_header(); if ( have_posts() ) { while ( have_posts() ) { the_post(); //get all the page data needed and set it to an object that can be used in other files $pexeto_page=array(); $pexeto_page['sidebar']=( 'Blog' ); $pexeto_page['slider']='none'; $pexeto_page['layout']=pexeto_option( 'post_layout' ); if ( in_category( ‘play )) { $pexeto_page['sidebar']=( 'Play' ); } elseif ( in_category( ‘blog' )) { $pexeto_page['sidebar']=( ‘Blog' ); } else { $pexeto_page['sidebar']=( ‘Careers ); } //include the before content template locate_template( array( 'includes/html-before-content.php' ), true, true ); //include the post template locate_template( array( 'includes/post-template.php' ), true, false ); //include the comments template comments_template(); } } //include the after content template locate_template( array( 'includes/html-after-content.php' ), true, true ); get_footer(); ?>But get an error: unexpected T_CONSTANT_ENCAPSED_STRING
Is it because I can’t use the if statement within the loop thats already there? its frying my brain a little – I’m no wordpress expert as you can tell 🙂
Thanks
DarrenHi esmi
Thanks for that, I’ve read up on it; and come up with this now; but don’t think it will work, as I now have a php within a php comment if that makes sense;
<?php /** * Single Post Template - this is the template for the single blog post. */ get_header(); if ( have_posts() ) { while ( have_posts() ) { the_post(); //get all the page data needed and set it to an object that can be used in other files $pexeto_page=array(); $pexeto_page['sidebar']=( 'Blog' ); $pexeto_page['slider']='none'; $pexeto_page['layout']=pexeto_option( 'post_layout' ); //include the before content template locate_template( array( 'includes/html-before-content.php' ), true, true ); <?php if ( in_category( ‘play )) { $pexeto_page['sidebar']=( 'Play' ); // They have long trunks… } elseif ( in_category( ‘blog' )) { $pexeto_page['sidebar']=( ‘Blog' ); } else { $pexeto_page['sidebar']=( ‘Careers ); } ?> //include the post template locate_template( array( 'includes/post-template.php' ), true, false ); //include the comments template comments_template(); } } //include the after content template locate_template( array( 'includes/html-after-content.php' ), true, true ); get_footer(); ?>I now get a parse error, could dou show me the error of my way? thank you in advance
Forum: Fixing WordPress
In reply to: Custom Field Correct Php FormattingThanks alchymyth that works like a charm 🙂
Forum: Fixing WordPress
In reply to: conditonal menuHi CrouchingBruin
Appreciate that – and in theory it makes sense but its not working
ANy suggestions?
Darren
Forum: Hacks
In reply to: Cycle through Single Posts of a particular categoryBasically this code below cycles works, it cycles through all the posts but I want it to omit posts in category ‘news’ any help would be appreciated
<?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if ( has_post_thumbnail() ) { ?> <?php } ?> <div class="gridly-copy"> <h1><?php the_title(); ?> </h1> <div class="detail"><?php the_content(); ?></div> <?php the_tags(); ?> <div class="clear"></div> <?php comments_template(); ?> </div> </div> <?php endwhile; endif; ?> <div class="post-nav"> <div class="post-prev"><?php previous_post_link('%link'); ?> </div> <div class="post-next"><?php next_post_link('%link'); ?></div> </div> <?php get_footer(); ?>Forum: Hacks
In reply to: Cycle through Single Posts of a particular categoryPlus its displaying only the most recent post
Forum: Hacks
In reply to: Cycle through Single Posts of a particular categoryThis works in displaying one post but doesn’t cycle through the remanding posts, any ideas?
Forum: Hacks
In reply to: Cycle through Single Posts of a particular categoryNo that wont do it as it just displays all the posts on the page where as I want them to scroll through using the Post next and post Prev buttons I have.
Forum: Hacks
In reply to: not displaying postsAwesome, thank you for all your help!!!
Forum: Hacks
In reply to: not displaying postsIve sorted the few rouge ‘”>’, but would still be interested it I could show all of a particular category such as ‘news’
Thanks again!!!!