• wyclef

    (@wyclef)


    Hi, I am trying to be able to style a link as the following in classic editor:

    <p><a class="download" href="#">Download <i class="icon-download"></i></a></p>
    

    I am looking at using $style_select to create an option to style a link but am unclear how to add the icon-download italic tag. Wondering If I am going about this the wrong way and some shortcode deal would be better?

    
    
              array( 'title' => 'Download Link', 'selector' => 'a', 'classes' => 'download' )
    

    Any suggestions?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    To easily add custom HTML into post content, a shortcode is a good solution. Any variable content such as the href attribute could be passed as a shortcode attribute, for example: [download link="2023/03/example.webp"]

    I’m assuming in this example that all downloads are in the /uploads/ folder somewhere, so the passed path/filename is relative to /uploads/. If preferable, the shortcode could instead be configured to accept any full URL regardless of where it leads.

    Additionally or as an alternative, if your download link icon is available in a font file such as dashicons, you could add the icon to any link with class “download” with CSS such as:

    a.download:after {
      font-family: dashicons;
      content: "\f316";
    }

    This could be used with or without the shortcode to insert the HTML, as long as the HTML is in content by whatever means.

Viewing 1 replies (of 1 total)
  • The topic ‘Insert Custom HTML for a special link’ is closed to new replies.