Hi guys,
Not sure what I’m doing wrong here as I’m new to PHP, but must be super easy for you guys! In my page I have:
<?php echo $title ?>
which obviously echoes the title of my custom post type in WordpressNow what I need is below that to post category name, which is called “case_studie_category”. Can’t for the life of me get it to work, all that happens is it shows me “array” front end. My script is attached.
Many thanks!
[code] else
{
$case_studie_category=$_POST[‘case_studie_category’];
$case_studie_theme=$_POST[‘case_studie_theme’];
$case_studie_sector=$_POST[‘case_studie_sector’];
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args = array(
‘post_type’ => array(‘case_studies’),
‘paged’ => $paged,
‘posts_per_page’ => 120
);
}
}
else
{
$case_studie_category=$_POST[‘case_studie_category’];
$case_studie_theme=$_POST[‘case_studie_theme’];
$case_studie_sector=$_POST[‘case_studie_sector’];
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args = array(
‘post_type’ => array(‘case_studies’),
‘paged’ => $paged,
‘posts_per_page’ => 120
);
}
$query = new WP_Query($args);
$i=1;
if ($query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$title= get_the_title();
$terms = get_the_terms( get_the_ID(), 'case_studie_category' );
$excerpt= get_the_excerpt();
$content= get_the_content();
$slug= basename(get_permalink());
$bg=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
$bg1=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' );
?>
<div class="fusion-one-third fusion-layout-column fusion-spacing-yes <?php
if($i%3 == "0" ) { ?> fusion-column-last <?php } ?>" style="margin-top:0px;margin-bottom:50px;">
<div class="fusion-column-wrapper" style="background-color:#ffffff;">
<a id="aaa_img" class="fusion-modal-text-link" data-toggle="modal" data-target=".<?php echo $slug ?>" href="#">
<img class="people alignnone wp-image-12047 size-full" src="<?php echo $bg1[0] ?>" alt="<?php echo $title ?>" />
</a>
<table style="width: 100%;">
<tbody>
<tr>
<td style="vertical-align: top;">
<div class="company-position">
<h2 style="margin-top:10px;font-size:20px"><?php echo $title ?></h2>
</div>
<div class="company-position">
<h2 style="margin-top:10px;font-size:20px"><?php echo $terms ?></h2>
</div>
</td>
</tr>
</tbody>
</table>
[/code]