Support » Plugin: Posts in Page » Shortcode to Toogle Excerpt

  • Resolved janewilliam

    (@janewilliam)


    Hi,

    I have commented out the code which does Excerpt but i badly need it on some place.

    Could you please tell me now can i create a new shortcode to turn excerpt on or off?

    Eg: [ic_add_posts category=’category-slug’ excerpt=’on’]

    Looking forward to have this or any other solution to toggle excerpt.

    Thanks

    http://wordpress.org/plugins/posts-in-page/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter janewilliam

    (@janewilliam)

    Seems no one is interested in this 🙁

    Yes I would like to know how to do this too.

    Thread Starter janewilliam

    (@janewilliam)

    I wish i had some solution to do this 🙂

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi janewilliam and ottomek,

    Right now, there’s no way to toggle the excerpt on or off via shortcode, but there’s a workaround:

    Since the plugin uses the posts_loop_template.php file from the plugin directory as a template for the output for Posts in Page, and you can have multiple output templates, you could try this:

    1. copy the posts_loop_template.php file to your theme directory before customizing.
    2. by default, the plugin looks for this posts_loop_template.php file in the root of your active theme first and, if it doesn’t find it, it looks in the plugin folder in /wp-content/plugins/posts-in-page
    3. once you’ve copied the file into your theme directory, you can change the name of this file and then you can specify the template you’d like to use in the shortcode as seen on the Installation page[ic_add_posts template='template-in-theme-dir.php'] – In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.

    So, in places where you’d like to show the excerpt, you can either use the default template, or specify a custom template that shows the exerpt, but for those where you’d like no excerpt, or maybe even the full post the_content(), you can customize the posts_loop_template.php file, save it as a different name in your theme folder, and point to it with the shortcode.

    Make sense?

    Hope that helps,
    Eric

    Thanks. That worked for me.

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Terrific. Glad to hear it. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Shortcode to Toogle Excerpt’ is closed to new replies.