Useful add-in codes: Outgoing/external [link] and +[button tag] for the Newspape

Posted in: Newspaper
Post count: 2

Propose to use.

1) Open all external links in a new window without additional plugins.
2)) Add buttons TO quickly INSERT your user html tags in the standard WP editor

For example, if you insert a third-party video or other your <div class=”myclass”> or your needs.

Tag <!–more–><!–noteaser–> (the syntax is exactly the two together!) is very useful when adding announcements to your posts: not shown on website, but appears when autoposting to Facebook. for example. The authors of the Council claim that this technique improves your SEO results.

The codes are given as used on my website.
Codes are added to the end of the file functions.php
Propose to use. The codes are not mine, found on the Internet, that’s exactly what I used on my site.

CODE: Add this to the end of your THEME functions.php
——————————————————————————
// external links in a new window
function autoblank($text) {
$return = str_replace(‘href=’, ‘target=”_blank” href=’, $text);
$return = str_replace(‘target=”_blank” href=”http://altervision.org&#8217;, ‘href=”http://altervision.org&#8217;, $return);
$return = str_replace(‘target=”_blank” href=”/’, ‘href=”/’, $return);
$return = str_replace(‘target=”_blank” href=”#’, ‘href=”#’, $return);
$return = str_replace(‘ target = “_blank”>’, ‘>’, $return);
return $return;
}
add_filter(‘the_content’, ‘autoblank’);
add_filter(‘comment_text’, ‘autoblank’);

//Add buttons TO quickly INSERT your user html tags in the standard WP editor

if( !function_exists(‘_add_my_quicktags’) ){
function _add_my_quicktags()
{ ?>
<script type=”text/javascript”>

QTags.addButton( ‘BONUS’, ‘БОНУС’, ‘<div class=”bonus”>’, ‘</div>’ );
QTags.addButton( ‘NOBonus’, ‘NoBonus’, ‘<div class=”nobonus”>’, ‘</div>’ );
QTags.addButton( ‘p’, ‘p’, ‘<p>’, ‘</p>’ );
QTags.addButton( ‘ava’, ‘AVA’, ‘<div class=”ava”>’, ‘</div>’ );
QTags.addButton( ‘vre’, ‘VRE’, ‘<div class=”vre”>’, ‘</div>’ );
QTags.addButton( ‘vcc’, ‘VCC’, ‘<div class=”vcc”>’, ‘</div>’ );
QTags.addButton( ‘noteaser’, ‘noteaser’, ‘<!–more–><!–noteaser–>’, ” );

</script>
<?php }
add_action(‘admin_print_footer_scripts’, ‘_add_my_quicktags’);
}

/*— (end of code)———————————

Screensort:Added buttons to standart WP txt editor, Example

  • This topic was modified 11 years by rgaweb. Reason: txt editing
  • This topic was modified 11 years by rgaweb.
Post count: 6600

Hi rgaweb,

Thanks for sharing this! I’ll add this on our request list, we’ll review the code and consider this for theme’s next versions.

Thanks for the message!
Have a nice day!
Lucian C.

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