So I’ve worked on this some more, and I’m really close to having it exactly as I want it.
I got the custom fields working, and I can pull in any page that shares the name with the directory page (dynamically), which is awesome. I got the Yoast SEO meta description to show, and the featured image, sweet. The only thing I haven’t been able to get, is the styling of this information, as it was before.
I’m essentially translating this:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class("full-width-post") ?> id="post-<?php the_ID(); ?>">
<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(260,200), array("class" => "alignleft post_thumbnail")); } ?>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<?php echo(get_post_meta($post->ID, '_yoast_wpseo_metadesc', true)); ?>
</div>
</div><!--/post-<?php the_ID(); ?>-->
<?php endwhile; ?>
<?php else : ?>
Into what I have now:
<?php
$this_page_title = get_the_title();
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'meta_key' => 'directory_category',
'meta_value' => $this_page_title,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_posts($args);
if($pages) {
foreach ($pages as $page) { ?>
<div class="full-width-post" >
<?php echo(get_the_post_thumbnail($page->ID, array(260,200))); ?>
<h2 class="title" id="post-<?php $page->ID; ?>"><a href="<?php echo(get_permalink($page->ID)); ?>" rel="bookmark" title="<?php echo(get_the_title($page->ID)); ?>"><?php echo(get_the_title($page->ID)); ?></a></h2>
<div class="entry">
<?php echo(get_post_meta($page->ID, '_yoast_wpseo_metadesc', true)); ?>
</div>
</div>
<?php
}
}
?>
The issue seems to be where I replaced post_class with a generic div tag with the same class, that didn’t translate to well (or the class isn’t even being used, I can’t tell).
What this should look like, as it did before, is the featured image on the left, the title on the top next to the image, with the meta description just below that to the right of the image. I’m amazed the styling is the part I’m stuck on, after learning all the wordperss php calls I just did haha. Anyone have any ideas how to get that class working, or if it is working, why it doesn’t look right?