seanjacob
Forum Replies Created
-
I have tried finding a manual for the plugin, do you know of one?
This doesn’t work when putting it into the actually code php page.
I am new to this plugin, and use custom fields a lot.
So with the example above how would I go about displaying the outputter text as there is no key to select a certain field.
I would normally do this
get_post_custom_values('custom-text');
I would also like to be able to track who is reporting my comments so I can block their IP.
Forum: Fixing WordPress
In reply to: How to show certain posts on a page?Thanks alchymyth, I manage to get the posts I want but I am having trouble displaying them in the order I input them in.
<?php $the_query = new WP_Query( array( 'post__in' => array( 44, 18, 36 ), 'orderby' => 'none' ) ); if( have_posts() ) : while ($the_query->have_posts()) : $the_query->the_post(); ?>
Any ideas?
Forum: Fixing WordPress
In reply to: How to have two different excerpt lengths?Update (above code wrong)
function get_the_popular_excerpt(){ $excerpt = get_the_content(); $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, 40); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); $excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>'; return $excerpt; }
Forum: Fixing WordPress
In reply to: Limit excerpt length by charactersEven better –
function get_the_popular_excerpt(){ $excerpt = get_the_content(); $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, 40); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); $excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>'; return $excerpt; }
Forum: Hacks
In reply to: Possible to have 2 excerpt lengths?Update to my code.
function get_the_popular_excerpt(){ $excerpt = get_the_content(); $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, 40); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); $excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>'; return $excerpt; }
Forum: Hacks
In reply to: Possible to have 2 excerpt lengths?My apologies ambrosite I didn’t realise your code was doing that, I am still learning. Also nice blog post.
Forum: Hacks
In reply to: Possible to have 2 excerpt lengths?Thank you for the reply, I also have been doing some research.
This is simpler
<?php echo substr(get_the_excerpt(), 0,30); ?>
Could also make it a function which also ends with a full word.
function get_the_other_excerpt(){ $excerpt = get_the_content(); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $the_str = substr($excerpt, 0, 50); $the_str = trim(preg_replace( '/\s+/', ' ', $the_str)); return $the_str; }
Call
<?php echo get_the_other_excerpt(); ?>
Forum: Fixing WordPress
In reply to: How to have two different excerpt lengths?or you can make a function –
function get_the_other_excerpt(){ $excerpt = get_the_content(); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $the_str = substr($excerpt, 0, 50); $the_str = trim(preg_replace( '/\s+/', ' ', $the_str)); return $the_str; }
This also ends with a full word.
Forum: Fixing WordPress
In reply to: Limit excerpt length by charactersAdd this to the function –
$the_str = substr($excerpt, 0, 20); $the_str = trim(preg_replace( '/\s+/', ' ', $the_str)); return $the_str;
boom!
Forum: Fixing WordPress
In reply to: Limit excerpt length by charactersthis is great but do you know how I would end with a full word?
Forum: Fixing WordPress
In reply to: How to have two different excerpt lengths?<?php echo substr(get_the_excerpt(), 0,30); ?>
This is by characters as well.
Forum: Hacks
In reply to: Possible to have 2 excerpt lengths?This is what I need but I am not understanding the post type ==’post_2′ coding.
I have looked at the codex page but still not fully understanding.