WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Title and description under image. Possible? (5 posts)

  1. antonel1
    Member
    Posted 2 years ago #

    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?

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    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.

  3. antonel1
    Member
    Posted 2 years ago #

    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?

  4. antonel1
    Member
    Posted 2 years ago #

    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');
  5. antonel1
    Member
    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic