kimbo_king — 2013-07-29T11:04:55-04:00 — #1
I’ve managed to integrate my blog into my website but I’m not sure if I’m doing it the cleanest way (I’ve picked it up from various blogs/ forums etc)
I’d also like to use tags or categories to select which posts to show (like a WHERE clause in SQL would)
IE: Only show posts with a tag (or category) of “YAL”
My code below:
$args = array( 'posts_per_page' => 20 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_content(); ?>
<?php wp_get_attachment_image(); ?><?php get_tag(); ?><?php get_category(); ?> (these don’t actually work)
<?php endforeach; ?>
kimbo_king — 2013-07-30T13:31:33-04:00 — #2
Thanks Force Flow
kimbo_king — 2013-07-31T14:18:51-04:00 — #3
I'm completely lost here, I've tried various methods (found online) but cant help but feel I'm missing the basics!
pullo — 2013-08-01T03:31:47-04:00 — #4
So let's briefly take a step back.
Could you tell us a little bit about what you have done.
Your title alludes to the fact that you have integrated WP into an existing site.
Is this correct?
Is the WP install confirmed as working?
It would help if you could share the url of your site.
kimbo_king — 2013-08-01T05:34:13-04:00 — #5
My site is not actually live yet but woill be www.togganet.co.uk.
I've uploaded the page with the wordpress features here: http://www.togganet.co.uk/YAL.php
When I say I've integrated it, I mean I have managed to pull from my worpress blog into my homepage. IE Take the article/ title etc
The blog is live on www.togganet.co.uk/blog - I want to use this as a background tool to populate my main site. I wnat to use categories to seperate different articles
pullo — 2013-08-01T05:39:00-04:00 — #6
Ok, so "Latest News/ Articles" is pulled in from your WP blog, which is on the same domain.
How are you doing that?
kimbo_king — 2013-08-01T10:14:55-04:00 — #7
I'm using the code below:
/* Don't remove this line. */
In addition to the code in the OP
pullo — 2013-08-04T07:29:42-04:00 — #8
I'm not sure that this is the best thing to do here, as by simply requiring the file "wp-blog-header.php" you don't have any control over how the output is formatted.
What is a more common way of doing this, is to embed a feed from your blog (which can then be ordered chronologically or whatever) in your main site.
The feed would be generated automatically and would contain the title of each article, a short blurb/description and a link to the full article.
kimbo_king — 2013-08-05T10:05:12-04:00 — #9
I'll look into this now
Really appreciete your help