You add your own shortcode that hooks directly into our listing plugin, but maybe you don't want to build your own html on the page. (see this help article).

This will need to be done by your wordpress web developer, but here is a working sample of creating a custom shortcode, that still uses the plugin templates to display the program content.

This short code adds a new attribute called offset , which skips the first number of programs in the list.
This also reproduces the same effect of the existing limit  attribute.

Here's what the normal [rs_programs] would show, it shows all the programs, starting with the
"Lodging Hotel Program".
Notice the 3rd program is "Multi Person Tiered".

The Shortcode

Just add the new custom shortcode to the content of a page.
[custom_rs_programs offset="3" limit="4"] 


Now view the page, and you will see that there are only 4 programs, and the list starts with "Multi Person Tiered", which was the 3rd program in the default list.

The Code

Here is the code you will need to add. This code can go into your functions.php  file.
You should be able to do this with a plugin like My Custom Functions

// set up the shortcode hook
add_shortcode( 'custom_rs_programs', 'custom_rs_programs_handler');

function custom_rs_programs_handler($atts, $content = null) {
    global $rs_the_programs;

    $output = '';
    // make sure calling the api doesn't cause a fatal error if the RS_Connect_Api class is not found
    $rs_connect_api = class_exists('RS_Connect_Api') ? new RS_Connect_Api() : null;
    // setup the default attribute you can pass into the shortcode
    $atts_defaults = array (
        'offset' => 0,
        'limit' => 0,
        // etc...
    );
    $args = shortcode_atts($atts_defaults, $atts);
    $offset = $args['offset'];
    $limit = $args['limit'];

    // make sure the $rs_connect_api class is available
    if ($rs_connect_api) {
        // you can use a different template files for different layouts
        // eg. 'shortcode-program-single.php' or 'shortcode-programs-table.php'
        $template = 'shortcode-programs.php';
        $vars = 'fields=_program_base_,_program_registration_,price_details';
        $rs_the_programs = $rs_connect_api::get_programs($vars);
        // the normal programs list does this, so if you want the same order, keep this
        $rs_the_programs = array_reverse($rs_the_programs);
        $rs_the_programs = array_slice($rs_the_programs, $offset, $limit);

        ob_start();
        $template_override = locate_template($template);

        if ($template_override) {
            include $template_override;
        } else {
            include ABSPATH.'wp-content/plugins/programs-remote-listings/templates/'.$template;
        }

        return ob_get_clean();
    }
}
Did this answer your question?