Formats in the automatic extracts

 Excerpt wordpress excerpt

The WordPress excerpts are wonderful, an element to keep in mind always, well they are that small part of the text that is shown on the front page of our website that, when well done, manages to attract the reader's interest in the article in question.

Also, currently most of the modern WordPress themes use excerpts on the cover . Except for blog style themes, all the others (grid, magazine, portfolio, etc.) show excerpts on the cover even if they are not defined expressly, most of them are created automatically.

Of course, you can always force the extracts by using tag " more " from the editor, or thanks to the wonderful meta-editor's WordPress box, but it's a liturgy that few bloggers use, although they should.

And then there's the theme of formats …

 custom extract with format and html wordpress

If you use the extract box you can create them with HTML, or even make it WYSIWYG as we saw ]but whether you create the extracts with the label " more " as if the theme generates them automatically you should know that WordPress will delete all text formats, all HTML and shortcodes .

This Running by default, which is usually the best option most of the time, is not always what you want. It's okay to obfuscate the shortcodes because they could tear apart your cover with extra features that would ruin your design, but on many occasions you would want to highlight some bold text on the cover, or even some link (without going over), and WordPress by default the fulmina in the extracts .

But everything has WordPress solution, and this too, so if you want that WordPress does not delete the formats in the automatic extracts you can create this function and add it to your function plugin or file functions.php of your active topic:

When you finish saving the changes and from that moment the extracts will respect the formats of the text, but not the shortcodes which does not stop being the best option, do not you think?

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Full editor for extracts • WordPress Help

// Editor for extracts

function tinymce_excerpt_js () { ?>

<script type = "text / javascript" >

jQuery ( document ) . ready ( tinymce excerpt ) ;

function tinymce_excerpt () {

[19659015jQuery ( "# excerpt" ) . addClass ( "mceEditor" ) ;

tinyMCE . execCommand ( "mceAddControl" false [1945] 9004] "excerpt" ) ;

tinyMCE . onAddEditor . add ( function ( mgr ed ) {

if ( ed . [19659044] id == "excerpt" ) {

ed . settings . theme_advanced_buttons2 ] = "" ;

ed . settings . theme_advanced_buttons1 = "bold, italic, underline, seperator, justifyleft, justifycenter, justifyright, separato r, link, unlink, seperator, pastetext, pasteword, removeformat, seperator, undo, redo, seperator, spellchecker, ";


} ) ;


<? Php }

add_action ( 'admin_head-post.php' 'tinymce_excerpt_js' ) ;

add_action ( ] 'admin_head-post-new.php' 'tinymce_excerpt_js' ) ;

function tinymce_css () { ?>

<style type = 'tex t / css'>

#postexcerpt .inside { margin : 0 ; padding : 0 ; ] background : #fff ; }

#postexcerpt .inside p { padding : 0px ] 0px 5px 10px ; }

#postexcerpt #excerpteditorcontainer { border-style : solid ; padding : ] ; }

<? Php }

add_action [19659004] ( 'admin_head-post.php' 'tinymce_css' ) ;

add_action ( 'admin_head-post-new.php' 'tinymce_css' ) ;

[19659195] function prepareExcerptForEdit ( $ e ) {

return nl2br ( $ e ) ;


add_action ( 'excerpt_edit_pre' 'prepareExcerptForEdit' ) [19659004];

Display a list of input excerpts from specific categories • WordPress Help

The truth is that I almost did not know how to make the title of this post shorter, but I wanted it to be explanatory because the thing has its fabric.

Today's trick has to do with the need, sometimes, for to show in the sidebar the last entries but not for any category, but for concrete categories and , in this example, in addition to showing an extract of the same entry .

Let's go! …

In today's code what we are looking for is to create a list of last entries, which will show only one entry per category which we will define which, and a small excerpt of the text of each entry shown.

For this we should create a code of this style and place it on the site of our template (usually sidebar.php ) where we want it to look:

The explanation of the code is simple:

  • In the first array we define the slug of the category / s of which we are going to show entries, in this case some of this same blog, that you will have to adapt to the ones you want.
  • In the third line we define the entries to show in each category with the argument & posts_per_page in this case 1.
  • In line 4 we tell you to show the title of the category with single_cat_title .
  • ] In line 6 we choose to show the title and also the extract of each entry, which can be removed simply by removing the call to the_excerpt .

And little else, I think it's a pretty simple code and, of course, practical. You will see your use.

NOTICE : This publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Show Google that your blog deserves to be first!

 prove to google that your blog deserves to be first

In our previous article we have reviewed some basic techniques for improve positioning from our wordpress blog on Google . Now we will review another very important point to continue optimizing our blog to the search engines.

I see very often that many bloggers publish all the content of their posts directly on the Home page …
Serious error for your positioning in Google!


Suppose your post is interesting and draws your user's attention … This will enter the Home of your blog, observe that there is information that interests you, read the article and possibly close the browser and continue your work day (glad to have received the knowledge that you have given). And your only benefit would be an additional visit to your statistics.

Let me tell you that this is not as beneficial as it seems, it could even be a disadvantage. The reason is that this user will increase the bounce rate of your blog (an SEO factor very considered by Google when making your search rankings).

The recommendation is to use the excerpts from articles in Home (three or four lines describing the content of your article). In this way, when the user enters Home, they will see only the title and extract of the article. You will notice that it is information that interests you and will press "click" to see the full article. This click is very valuable in the eyes of Google, since it is a sign of interest to the content of your blog (a sign of interest emitted neither more nor less than by a user, the main objective of Google).

If a high percentage of your users "click" on the excerpts or internal links of your blog, speak of interest and satisfaction in the content that you publish. Therefore, you have a very favorable point for Google to want to show your content to users and make you climb positions in your ranking 🙂  Google Analytics Bounce Percentage

And how does Google realize if the user clicked at least once on my site?

If you use Google Analytics (which is very likely because we all love this wonderful statistics service) you are giving full permission to Google to see and analyze the behavior of your users within your blog.

(see image on the right)

The percentage of bounce is specified in the start screen of Google Analytics, an indicator of the importance that this parameter has for Google no?

I do not want this article to motivate to uninstall Google Analytics … On the contrary, we must work to gain clicks on the links of our blog, reducing our bounce rate and climbing positions in the Google rankings 🙂

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

Show excerpts without touching the topic

Of course, you can modify the look of your active theme and have it show excerpts of the entries instead of the entire content, but if that's the behavior you want, it's always more practical add some code to the file functions.php and use it wherever you want.






















22 [19659004] 23



function mis_extractos ( $ content = false ) {

// If title page, archive or search results

if ( is_front_page () || is_archive () || is_search () ) :

global $ post ;

$ content = $ post -> post_excerpt ;

// If an extract is specified in the editor widget

if ( $ content ) :

$ content = apply_filters [19659030] ( 'the_excerpt' $ content ) ;

// If you do not specify a abstract [19659000] else :

$ content = $ post -> post_content ;

$ excerpt_length = 55 ;

] $ words = explode ( '' $ content [1945902] 1] $ excerpt_length + 1 ) ;

if ( count ( $ words ) > $ excerpt_length ) :

array_pop ( $ words ) ;

array_push ( $ words '. .. ') ;

$ content = implode (' ' $ words ) ;

endif ;

$ content [19659032] = '

' . $ content . ''


endif ;

endif ];

// And we make sure to go back to the content

return $ content ;


add_filter ( 'the_content' 'my_extractos' ) ;

Show content … or extract • WordPress Help

We have already seen how to show the content or the excerpt of the entries on the cover of your website, they are actually small variations of the loop it would be something like this: [19659002] But what happens if we want to show the extract and sometimes there is no extract, for example when the entry contains only one image? So simple, thanks to this trick that shares Study in the WordPress forum :

What the code does, as you can imagine, is to try to show the extract, and if not There is sample content. Chulo, huh?

Limit the size of extracts and content

If you want to improve page impressions (bad) or offer a different look on your blog through content or reduced excerpts (very useful in magazine type themes) there are, as usual, two modes of get it, with code and with plugin.

– With this simple plugin you can define the size in words of extracts or content. To use it this is the process:

– Just add the following code to the 'functions.php' file of your active theme:

< ? php [19659007] the_excerpt_reloaded ; ?>

That would be the default configuration, which would show 120 words, the first 120 of your post. But you can set the number of words to another quantity, for example to 75, just by adding this:

There are more features you can add. If you want, as I said at the beginning, to show the images, you'll have to put it like this:

What do you want to add the "keep reading …" to your excerpt, you just have to add this:

There are many modifiers, here is the complete list:

  • excerpt_length
    Number of words to show. By default 120.
  • allowedtags
    Defines which tags HTML tags keep in the extract. Use the format ''. For several tags, enter a single string: ' '. Default is ''.
  • filter_type
    Defines how WordPress will filter / format the content of the extract. The options are based on the content / extract tags :: ' content ', ' content_rss ', ' excerpt', ' excerpt_rss ] '. If you set it to ' none ' to display raw content. Default is ' excerpt '.
  • use_more_link
    If the link "more" will be displayed (TRUE) or not (FALSE). If set to ' false ' the function shows (...) if there is more content to show; it does not show even that if what there is is less than the excerpt_length ; By default it is TRUE.
  • more_link_tex t
    If use_more_link is set to TRUE it is defined which text to use for the link. Default is ' (more ...) '.
  • force_more_link
    Displays the link to ' plus ' (TRUE) or not (FALSE), even though the extract is less than excerpt_length . Default is FALSE.
  • fakeit
    Use the content as extract (1) or not (0) if the extract is empty. If you set it to 2 it forces the content to behave as an extract in any situation. By default it is 1.
  • fix_tags
    "Repairs" HTML tag elements (TRUE) or not (FALSE). This has been included to deal with incorrectly closed tags, caused by the excerpt_length . If fix_tags is set to FALSE the plugin will not try to validate XHTML and repair tags that are not closed correctly (because excerpt_length breaks them into the intermediate elements). By default it is TRUE.

As you can see its possibilities are very interesting, to have an absolute control of the extracts. I hope you like it.

NOTICE : This publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: