• Resolved ResaMichelle

    (@resamichelle)


    Is it possible to wrap the link in header tags?

    Currently, the layout is:

    <a href="link">
    <img src="image" />
    <br>"Link Text"
    </a>
    "—"
    <span class="link description">
    "Link description"
    </span>

    I’d like it to be:

    <a href="link">
    <img src="image" />
    <h3>"Link Text"</h3>
    </a>
    <span class="link description">
    "Link description"
    </span>

    So basically, I want to remove the link break, wrap the link text itself in header tags, and remove the separator between the link and description.

    How would I go about this?

    http://wordpress.org/plugins/simple-links/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mat Lipe

    (@mat-lipe)

    Hi ResaMichelle,

    You may achieve this by tapping into the simple_links_link_output filter like so.

    add_filter( 'simple_links_link_output', 'adjust_simple_links_output',99, 6 );
    function adjust_simple_links_output( $output, $data, $link, $image, $args, $obj ){
          $obj->args['remove_line_break'] = true;
          $image = $obj->getImage();
          $output = sprintf('<a href="%s" target="%s" title="%s" %s>%s<h3>%s</h3></a>',
                                        $obj->getData('web_address'),
                                        $obj->getData('target'),
                                        strip_tags( $obj->getData('description') ),
                                        empty( $obj->meta_data['link_target_nofollow'][0] ) ? '': 'rel="nofollow"',
                                        $image,
                                        $link->post_title
          );
          return $output;
    }

    Hope this helps!

    Thread Starter ResaMichelle

    (@resamichelle)

    Thanks, this is perfect!

    Plugin Author Mat Lipe

    (@mat-lipe)

    You are welcome!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wrap link in header tags?’ is closed to new replies.