Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

dterpin on "Putting Posts on a differnet page, then styling them with CSS"

$
0
0

OK, Im aware that I am a hack and I am building a child theme. What I am trying to accomplish is to use the "add a post feature" to put a except and image into a stylized div on a page. It should look like a blog except.

I have found some nice code that allows me to pull out the posts, and display them on any page I'd like. With this code I can even add some CSS styling to the elements found in the posts content, but then I have trouble ... For example I cant isolate the images from the the_content with CSS since it is somehow locked into the content.

The pulling posts out and inserting them into the loop is here <?php $loop = new WP_Query( array( 'post_type' => 'yourposttypehere', 'posts_per_page' => -1 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
The stuff you want to loop goes in here
<?php endwhile; wp_reset_query(); ?>

So, In the "The stuff you want to loop goes in here" box I use some php command like echo "<h1> ";
echo $post->post_name;
echo "</h1>";

to style the post name.

I also have tried "echo"<div><style>

p{background-color:grey;
margin-top:1px;
font-style:italic;
font-size:14px;
color:yellow;
padding-bottom:20px;
align:center;

width:500px;}

}

img{border:5px green dotted;

margin-top:10px;
margin-left:300px;
padding:0px;
}
img.size-full {
max-width: 15%;
}
</style></div>";

the_content(); ?>"

to stylize the text, and the image.

But I dont even know where to look for finding out where the the_content>image lives so I can surround it in a Div, and reposition it.

This sure seems like it is possible to recreate little mini pages from the blog pages (like articles on a newspaper, using the the_except(); and the the_content()'s images, but honestly I dont even know where to look.
Can someone help me to style these posts and stick abridged versions of them on a page please? Or at least point me in the right direction?

Thanks in advance


Viewing all articles
Browse latest Browse all 8245

Trending Articles