I’m trying to get my posts to show up with the first image of the post at the top, then the title, then the post text, then the rest of the images.
|img |
|title|
|text |
|img |
|img |
|img |
|…..|
I’m somewhat succeful in breaking down the posts into parts and rearranging them.
<?php get_header();?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post_single" id="post-<?php the_ID(); ?>">
<?php
$beforeEachImage = "<div>";
$afterEachImage = "</div>";
preg_match_all("/(<img [^>]*>)/",get_the_content(),$matches,PREG_PATTERN_ORDER);
for( $i=0; isset($matches[1]) && $i < count($matches[1]); $i++ ) {
echo $beforeEachImage . $matches[1][$i] . $afterEachImage;
}
?>
<div id="post">
<h2 class="small"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> <?php edit_post_link('- Edit Post'); ?></h2>
<br><div class="postmetadata-top"><small><?php the_date('F d, Y'); ?> </small></div>
</div>
<div class="content"><?php
ob_start();
the_content('Read the full post',true);
$postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
ob_end_clean();
echo $postOutput;
?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer();?>
Using the above code I get this:
|img |
|img |
|img |
|img |
|…..|
|title|
|text |
I tried using
<?php echo catch_first_image() ?>
but that just gives me a link to the image and doesn’t display the image.
Also how would I adress the remaining images to be shown at the bottom of the post?
Best regards,
thf
]]>I have site and i have entered wrong order article so i want to re-arrange it and for that i have added one column into wp_posts table called “position” and i have entered position with proper order now i have to change the orderby into wordpress to display the article into proper order as i want.
Default it is orderby menu_order now i want to change this by position.
How can i do this, can any one help me out from this issues?
Thanks,
Jignesh
I have site and i have entered wrong order article so i want to re-arrange it and for that i have added one column into wp_posts table called “position” and i have entered position with proper order now i have to change the orderby into wordpress to display the article into proper order as i want.
Default it is orderby menu_order now i want to change this by position.
How can i do this, can any one help me out from this issues?
Thanks,
Jignesh
Blog Page1 Page2 Page3
transform to this:
Page1 Page2 Blog Page3
]]>BLOGROLL TITLE
Link, Link, Link, Link, etc.
Instead of this:
BLOGROLL TITLE
Link
Link
Link
Link
etc.
Can anyone tell me how to do this?
]]>How can I re-order the plugin features that appear on my post-edit page?
I recently installed a new plugin, while nice, I don’t need to use it often. However, it’s very much in the way of other options I use to write posts on a daily basis.
I’d like to move the option for this plugin to the bottom of the edit page, right above the “delete post” button.
Any simple way to do this?
Your help is appreciated, and have a happy new year!
]]>