WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Title and description under image. Possible?

[Resolved] Title and description under image. Possible?

  • How can I put the entry’s title (the_title) and description (post_meta) under the image instead of it’s default which is above?

    The only solution I found was to insert a shortcode mentioned here. This works well, however it doesn’t insert description. How can I create a shortcode for description so that it can do the same?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Pioneer Web Design
    Participant

    @swansonphotos

    The best way is: Using a Child Theme, edit header.php file (which starts as a copy of original header.php file from parent theme) and rearrange accordingly.

    Thanks. However, I’m referring to individual posts. I tried rearranging the coding in single.php, but it won’t work because I can’t break apart the_content.

    I don’t mind using shortcode, but how can I make one for description too?

    How can I insert sub-title into this short code?

    function mm_insert_title_func($atts) {
       global $post;
       extract(shortcode_atts(array('before' => '<h2 class="title-after-photo">', 'after' => '</h2>' ), $atts));
    $output = "{$before}{$post->post_title}{$after}";
    return $output;
    }
    add_shortcode('mm-insert-title', 'mm_insert_title_func');

    Okay, I figured it out. To move title under image I used the method provided from this website.

    – Insert this code in functions.php

    function mm_insert_title_func($atts) {
       global $post;
       extract(shortcode_atts(array('before' => '<h2 class="title-after-photo">', 'after' => '</h2>' ), $atts));
    $output = "{$before}{$post->post_title}{$after}";
    return $output;
    }
    add_shortcode('mm-insert-title', 'mm_insert_title_func');

    – Then place this shortcode in the edit area of your post:
    [mm-insert-title]

    Done! Hopefully someone will find this tip useful someday!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Title and description under image. Possible?’ is closed to new replies.