Query Custom Post Type and Output to timeline
I have a wordpress query that outputs posts that contain the following info: - year - link to a pdf-file - title - post image
so its essentially an archive for yearly reports dating back to the 1860's until today. For the early days there arn't pdf-files/posts for every year. in the newer days in some years there are multiple files per year.
i would need the query to output an UL with the following configuration:
<ul>
<li class="decimal-year pdf-present"><a href="#">1860</a><div>Image, Title, PDF Link in Post</div></li>
<li class="normal-year pdf-present"><a href="">1861</a><div>Image, Title, PDF Link in Post</div></li>
<li class="normal-year no-pdf"><a href="#">1862</li>
</ul>
so the class should contain info if its "decimal" year like 1860, 1870, 1880, etc. or a year inbetween like 1861, 1862, 1863, etc. Then there needs to be a class noting if theres a corresponding yearly post or not. (the links will be displayed on a visual timeline) so even if there is no yearly output, there still needs to be a li element. if there are multiple files in a year there should be another ul in the div containing the data.
thats quite a query i know!
heres the query so far:
// set the query
$query = array (
'post_type' => 'jahresberichtpdf',
'orderby' => 'jahresberichtjahr'
);
// loops
$queryObject = new WP_Query($query);
if ($queryObject->have_posts()) : ?>
<?php while ($queryObject->have_posts()) : ?>
<?php $queryObject->the_post(); ?>
<li>
Title:<?php the_title(); ?>
Thumbnail:<?php the_post_thumbnail('thumbnail'); ?>
<strong>PDF:</strong> <?php print_custom_field('jahresberichtfile:to_link'); ?>
<strong>Year:</strong> <?php print_custom_field('jahresberichtjahr'); ?>
</li>
<?php endwhile; ?>
<?php endif; ?>
has anybody done a query like this or would be up for the challenge? if someone is willing to put some effort in, i would show my appreciation in form of a paypal donation!
thanks, mark
I have a wordpress query that outputs posts that contain the following info: - year - link to a pdf-file - title - post image
so its essentially an archive for yearly reports dating back to the 1860's until today. For the early days there arn't pdf-files/posts for every year. in the newer days in some years there are multiple files per year.
i would need the query to output an UL with the following configuration:
<ul>
<li class="decimal-year pdf-present"><a href="#">1860</a><div>Image, Title, PDF Link in Post</div></li>
<li class="normal-year pdf-present"><a href="">1861</a><div>Image, Title, PDF Link in Post</div></li>
<li class="normal-year no-pdf"><a href="#">1862</li>
</ul>
so the class should contain info if its "decimal" year like 1860, 1870, 1880, etc. or a year inbetween like 1861, 1862, 1863, etc. Then there needs to be a class noting if theres a corresponding yearly post or not. (the links will be displayed on a visual timeline) so even if there is no yearly output, there still needs to be a li element. if there are multiple files in a year there should be another ul in the div containing the data.
thats quite a query i know!
heres the query so far:
// set the query
$query = array (
'post_type' => 'jahresberichtpdf',
'orderby' => 'jahresberichtjahr'
);
// loops
$queryObject = new WP_Query($query);
if ($queryObject->have_posts()) : ?>
<?php while ($queryObject->have_posts()) : ?>
<?php $queryObject->the_post(); ?>
<li>
Title:<?php the_title(); ?>
Thumbnail:<?php the_post_thumbnail('thumbnail'); ?>
<strong>PDF:</strong> <?php print_custom_field('jahresberichtfile:to_link'); ?>
<strong>Year:</strong> <?php print_custom_field('jahresberichtjahr'); ?>
</li>
<?php endwhile; ?>
<?php endif; ?>
has anybody done a query like this or would be up for the challenge? if someone is willing to put some effort in, i would show my appreciation in form of a paypal donation!
thanks, mark
No comments:
Post a Comment