Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #750565

    Hi,
    I’ve introduced a custom field to show an overline / deck head above a post’s heading (variable name $dachzeile) instead of the category name.
    Works fine on the post page itself – I managed to add this code snippet to loop-index.php:

    $dachzeile = get_post_meta($post->ID, 'dachzeile', true);
    				if($dachzeile != '') {  echo '<div class="dachzeile">' . $dachzeile . '</div>'; }
    				else { echo '<div class="dachzeile">'; the_category(' / '); echo '</div>';}

    However, I struggle to modify postslider.php in the correct way.
    Tried to modify the line with h3 like this …

    $output .= "<div class='dachzeile_startseite'>".$dachzeile."</div><h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>";

    … (fallback option from above not implemented yet), but the value of the custom field does not appear.

    • What is missing to make the custom field data loading (getting it into the loop, registering support for custom fields within a custom post type in supports $args etc.)?
    • How does the correct code with fallback option (“use category name if $dachzeile is empty”) look like?

    Thanks!

    • This topic was modified 7 years, 8 months ago by fmg. Reason: Addtional links/explanations
    #752588

    Hey fmg,

    Can you try to post the whole code in http://pastebin.com/index.php and give the link to us, so we can check. As for the overlines, I’m not really sure what you meant, is it the one with purple background? I can’t see any on the 2nd link.

    Best regards,
    Nikko

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.