Skip to content

Instantly share code, notes, and snippets.

@flipty
Created September 19, 2022 20:07
Show Gist options
  • Save flipty/768959ca8a98340fac0a8905b0b47189 to your computer and use it in GitHub Desktop.
Save flipty/768959ca8a98340fac0a8905b0b47189 to your computer and use it in GitHub Desktop.
Entrust manifest
<?php
/* Template Name: Manifest */
get_header(); ?>
<?php
if(have_posts()):
while(have_posts()): the_post();
the_content();
endwhile;
endif;
?>
<?php
$postArgs = array(
'post_type' => 'post',
'posts_per_page' => -1
);
$authorArgs = array(
'post_type' => 'contributor',
'posts_per_page' => -1
);
$manifest_posts = new WP_Query($postArgs);
$manifest_authors = new WP_Query($authorArgs);
$imageCount = 0;
$postCount = $manifest_posts->found_posts;
$authorCount = $manifest_authors->found_posts;
?>
<style media="screen">
.main-header {
display: none !important;
}
.item h2 { font-size: 13px;}
.item h3 { font-size: 12px;}
.item h4 { font-size: 11px;}
</style>
<h1>Manifest - <?php echo $postCount; ?> posts, <?php echo $authorCount; ?> Authors</h1>
<div class="manifest-row">
<?php
if($manifest_posts->have_posts()) :
while($manifest_posts->have_posts()) :
$manifest_posts->the_post();
?>
<div class="item">
<h2><?php the_title() ?></h2>
<h3>ID: <?php echo get_the_ID();?></h3>
<h4>BY:
<?php if (get_field('post_author')) {
$author = get_field('post_author');
foreach($author as $auth):
echo get_the_title($auth); echo ' ';
endforeach;
if ( ! is_array($author) ) {
echo '<span style="color: red;">';
echo get_the_title($author); echo ' (NON-ARR)';
echo '</span>';
}
} ?>
</h4>
<h4>DATE: <?php echo get_the_date('M Y');?></h4>
<h4 class="permalink"><?php echo str_replace(home_url(), '', get_permalink());?></h4>
<a href="/blog/wp-admin/post.php?post=<?php echo get_the_ID();?>&action=edit">EDIT</a> |
<a href="<?php echo get_the_permalink();?>">VIEW</a>
<?php $alignment = get_field('image_focal_point');
?>
<?php if ( has_post_thumbnail() ) {
$image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full', false );
echo '<p class="featuredimage">Featured Image: ';
echo $image_data[1]; echo ' x '; echo $image_data[2];
if ($alignment){
echo ' - '; echo get_field('image_focal_point');
}
echo '</p>';
/*$imageCount ++; echo $imageCount; echo ')';*/
?>
<!-- <img src="<?php echo get_the_post_thumbnail_url();?>" alt=""> -->
<a href="<?php echo get_the_post_thumbnail_url();?>"><?php the_post_thumbnail('full');?></a>
<?php the_post_thumbnail('thumbnail');?>
<?php } ?>
<?php if (get_field('search_card_image')) { ?><p class="cardimage">Search Card Override:</p><img src="<?php echo get_field('search_card_image');?>" class="search-card"> <?php }?>
<?php if ( has_category() ) { the_category(); }?>
</div>
<?php
endwhile;
else:
?>
Oops, there are no posts.
<?php
endif;
?>
</div>
<?php
//bloginfo('rss2_url');
//bloginfo('atom_url');
?>
<?php
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment