WordPress.org

Ready to get started?Download WordPress

Forums

wpLike2Get
[resolved] Want to Add Like Box Automatically After 50 Words (9 posts)

  1. vishnudath
    Member
    Posted 1 year ago #

    I want to automatically add [l2g] after 50 words and [/l2g] at the end of post. If it does this then it will be very easy for me so that the like box will be added automatically after 50 words for all of my already published posts.

    when i tried to do this, by adding a filter in my theme functions.php

    it looks like this > http://s1291.beta.photobucket.com/user/vishnudath/media/wplike2get_zps0339d6ae.png.html

    can any one help me in this issue...
    waiting...

    Regards,
    Vishnudath

    http://wordpress.org/extend/plugins/wplike2get/

  2. Markus Drubba
    Member
    Plugin Author

    Posted 1 year ago #

    Please provide the solution that you already have.

  3. Markus Drubba
    Member
    Plugin Author

    Posted 1 year ago #

    Try to use this, it adds the like box after the first paragraph. Inserting after 50 words is bad because you can break some html markup.

    function md_filter_l2g_content($content) {
    	if( is_main_query() ) {
    		list($before, $after) = explode('</p>', $content, 2);
    	}
    	return $before . '[l2g home_text="<p><a href=\''.get_permalink($post_id).'\'>read more after like on single page</a></p>"]' . $after . '[/l2g]';
    }
    add_filter('the_content', 'md_filter_l2g_content');
  4. vishnudath
    Member
    Posted 1 year ago #

    @drumba Thanks a lot :)

    every thing is fine. but the text "read more after like on single page" is not showing there :/

    Thanks for the Help :)

  5. Markus Drubba
    Member
    Plugin Author

    Posted 1 year ago #

    You need to set the Singleview option (in the backend or directly via shortcode):

    function md_filter_l2g_content($content) {
    	if( is_main_query() ) {
    		list($before, $after) = explode('</p>', $content, 2);
    	}
    	return $before . '[l2g single="true" home_text="<p><a href=\''.get_permalink($post_id).'\'>read more after like on single page</a></p>"]' . $after . '[/l2g]';
    }
    add_filter('the_content', 'md_filter_l2g_content');
  6. vishnudath
    Member
    Posted 1 year ago #

    @drumba will u please let me know where the "Singleview" option is..

    i have checked it in all my WP Dashboard tabs. but i didn't find that option :(

  7. Markus Drubba
    Member
    Plugin Author

    Posted 1 year ago #

    The option is named: "Show on single only" under general.

    This option is available since version 1.2.2. Please ensure that you use the last version of the plugin.

  8. frankboee
    Member
    Posted 1 year ago #

    Hello, How to add like box after second paragraph?

    Another question is:
    How to add some texts like
    "Full Content can be seen after liking any of these buttons" from function itself with out hampering SEO.

  9. Markus Drubba
    Member
    Plugin Author

    Posted 1 year ago #

    You can not add it automatically after the second paragraph. You can put your content between the l2g shortcode, than it is automatically hidden without any SEO problems.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags