Improved Include Page Plugin for WordPress

Improved Include Page

Improved Include Page (IIP) allows you to use a shortcode to include the content of any page inside any other page or post. This makes it easier to manage content that needs to be published in multiple pages.

You can download this plugin from the WordPress plugin repository.

Plugin Features Include

  • Page title can be displayed with optional HTML code.
  • Content can be displayed with different styles (full, teaser, custom ‘more' link).
  • WordPress filters are applied to both the content and the title.
  • Supports the WordPress Shortcode API.

Parameters

The current version supports the following parameters:

  • displayTitle (boolean) toggle title display
  • titleBefore/titleAfter (string) string to display before and after the title
  • displayStyle (integer constant) one of the following:
    • DT_TEASER_MORE – Teaser with ‘more&' link (default)
    • DT_TEASER_ONLY -Teaser only, without ‘more' link
    • DT_FULL_CONTENT – Full content including teaser
    • DT_FULL_CONTENT_NOTEASER – Full content without teaser
  • more (string) text to display for the ‘more' link

Examples

Example 1: using Shortcode API in posts or pages
You can include a page's content in a page/post using the syntax:

[include-page id=”123″]

or

[include-page id=”3″ displayTitle=”true” displayStyle=”DT_TEASER_MORE” titleBefore=”<h3>” titleAfter=”</h3>” more=”continue»”]

Example 2: basic usage in templates
If you wish to include the content of page number ‘4' insert the following code into your template file (e.g. sidebar.php):

or

<?php echo iinclude_page(4, null, true); ?>

In order to avoid PHP errors if the plugin is disabled, you should use the function with the following syntax:

<?php if( function_exists( ‘iinclude_page' ) ) iinclude_page( 4 ); ?>

Example 3: using optional parameters in templates

You can also display the page title using the following code:

<?php iinclude_page( 4, ‘displayTitle=true&titleBefore=<h2 class=”sidebar-header”>' ); ?>

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading...

15 Comments

  1. hi , the plugin is brilliant , but i have a problem when i use it ,
    it is working when inlcude file is in page (example id="117")
    but it is not working if the install file is at post (example id="118")

    both i use the code below, just the id different
    [include-page id="117"] [include-page id="118"]

    thank again for the great job

    mango

    • The plugin includes pages only. You can include a page into a post, but you can't include a post into something else.

      • thank a lot !

  2. The plug-in stopped working this morning. My client posted a new page and a new event and the shortcode is no longer pulling in the include. I've since deleted the new page and the new event, but still nothing :(

    http://fiddlersmusicbar.com/livemusic/

    • What else was done? Was WordPress upgraded? Were other plugins installed? Something had to happen to cause the plugin to stop working.

      • Yeah, I've just looked at version numbers and the EventsCalendar plugin was updated to 4.1.4 yesterday and it looks like my client has autoupdates turned on. The individual events are still pulling in the content perfectly, it's just list view that's no longer pullling in the content.

        Events that contain their own text do show up content and featured image in list view, it's the ones with includes that are not and they make up the majority of the events.

        • First, auto-updates are bad (in my opinion) :-)

          Second, if your need is critical, you could try going back to an older version of the Events Calendar. Older versions are here: https://wordpress.org/plugins/the-events-calendar/developers/. I can't guarantee this will work as every plugin is different.

          Third, I'm going to install the latest Events Calendar to see if any errors that show up. I'll let you know if I find anything.

        • I've installed the Events Calendar plugin. I created an event and I included a page. When I view the event I see the included content.

          When I go here /events/list/ I see the event, but without the included content. Is that the problem?

          I also tried a few older versions of the plugin and the included content didn't show on the list view. What was the last version of the plugin where this functionality worked as you described?

        • I'll switch off auto updates.

          [quote]
          When I go here /events/list/ I see the event, but without the included content. Is that the problem?
          [/quote]

          Yes, exactly that.

          [quote]
          I also tried a few older versions of the plugin and the included content didn't show on the list view. What was the last version of the plugin where this functionality worked as you described?
          [/quote]

          As autoupdate is running, it must've been 4.1.3 we were using before. I know it was fine until two days ago. it was seven days ago that I did all the work to get your plug-in to work with excerpts. Weird that you can't get older versions to show content in list view. It's not mission critical - my client is okay with just the links and dates. I do have a backup of everything, but restoring that seems a bit like a sledgehammer to crack a nut.

          Thank you for your input and for the link to the previous versions

  3. Hi,

    This is a superb plug-in for a client of mine who runs a bistro and an events calendar. I've uncommented the two lines you had so thoughtfully included for users running the EventCalendar plug-in and it works really well. However it doesn't work in the Excerpt field for posts in the EventCalendar. Is there a way of implementing this that you know of?

    Many thanks.

    • That isn't something I've considered. Off-hand I'm not sure what it would take.

      • Okay. Thanks for the quick response. I've googled and come up with this: add_filter( 'the_excerpt', 'do_shortcode');
        But it doesn't work. I'll keep looking but I'm quickly getting beyond my skills!

        • I've just found a page that says shortcode is disabled in the excerpts field of the Events Calendar on purpose.

          https://theeventscalendar.com/function/tribe_events_get_the_excerpt/

          I'm now officially out my depth! Thing is, if your shortcode plug-in works only in body text for events and not in the excerpts field, I'll have to go back to doing them all manually again. That kind of defeats the purpose of the shortcode plug-in. My client isn't happy to have no text displayed where the excerpt would show.

        • I did it! I changed the 'false' to 'true' in this line of code and it worked! (line 1338 in src/functions/template-tags/general.php)

          $allow_shortcode = apply_filters( 'tribe_events_excerpt_allow_shortcode', false );

        • Well done!

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail.