• Resolved vandestouwe

    (@vandestouwe)


    In the post the shortcode while rendering is executed perfectly and displays two thumbnails. When I run the code via a plugin which i’m developing:
    $content = do_shortcode('[ngg src="tags" ids="Y2021 M1 D10" display="basic_thumbnail"]');
    And follow the code the ngg shortcode tags is missing. I tryed your suggestion from a while back:
    `$renderer = C_Displayed_Gallery_Renderer::get_instance();
    echo $renderer->display_images(array(
    ‘src’ => ‘tags’,
    ‘ids’ => array(‘Y2021 M1 D10’),
    ‘display’ => ‘basic_thumbnail’
    ));.
    That gives the error: Exception thrown
    No utilities registered for I_Display_Type_Controller

    Please assist me how i can make sure the ngg shortcode is available or what must I do to get around the exection error

    Kind Regards, Sidney van de Stouwe

    • This topic was modified 5 years, 2 months ago by vandestouwe.
    • This topic was modified 5 years, 2 months ago by vandestouwe.
    • This topic was modified 5 years, 2 months ago by vandestouwe.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Benjamin

    (@benjaminowens)

    That could be possible if you are running this code before NextGEN has initialized and loaded; how / when are you invoking that PHP?

    Thread Starter vandestouwe

    (@vandestouwe)

    The problem is that nextgen is seeing the page as an admin page. So, when I have an array of posts nextgen cannot do the function do_shortcode().

    Benjamin

    (@benjaminowens)

    You can make NextGEN load its display logic in the WP-Admin by applying __return_true to the filter `ngg_load_frontend_logic’. It passes a second parameter of the module name if you wish to only enable certain display types.

    Thread Starter vandestouwe

    (@vandestouwe)

    I added the filter as you suggested:

            public function wmc_load_frontend_logic($p1, $p2) {
                    __return_true();
            }

    I would think this would enable the shortcode the tag but it is stillnot there. In an other plugin triggerred by a post_row I do see the shortcode tag: “ngg”.

    The folowing series of command lead to some action. I’m getting the default template:

    $utl = C_Component_Registry::get_instance();
     $utl->add_utility( 'I_Display_Type_Controller', 'C_Display_Type_Controller');
     $utl->add_utility( 'I_Displayed_Gallery_Renderer', 'C_Displayed_Gallery_Renderer' );
     $utl->add_adapter('I_MVC_View', 'A_Gallery_Display_View');
     $utl->add_adapter('I_MVC_View', 'A_Displayed_Gallery_Trigger_Element');
     $utl->add_adapter('I_Display_Type_Controller', 
     'A_Displayed_Gallery_Trigger_Resources');
     $renderer = C_Displayed_Gallery_Renderer::get_instance();
     $reply = $renderer->display_images(array('src' =>	'tags', 'ids' => array('Y2021 M1 D10'), 'display' => 'basic_thumbnail' ));

    $reply than contains:

    (string) <h1>Default Gallery Type Template</h1>
    <p>
    	This is the default gallery type template, located in:<br/>
    	<b>C:\xampp\htdocs\wp\wp-content\plugins\nextgen-gallery\products\photocrati_nextgen\modules\nextgen_gallery_display\templates\index.php</b>.
    </p>
    <p>
    	If you're seeing this, it's because the gallery type you selected has not
    	provided a template of it's own.
    </p>

    So all in all not yet an success

    • This reply was modified 5 years, 2 months ago by vandestouwe.
    Benjamin

    (@benjaminowens)

    @vandestouwe What you have there is a method that is executing __return_true but that doesn’t actually have any effect, your wmc_load_frontend_logic() is actually returning null.

    Try using add_filter('ngg_load_frontend_logic', '__return_true'); — you could also use return true; in your existing method.

    Thread Starter vandestouwe

    (@vandestouwe)

    Thanks @benjaminowens this works fine now.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘ngg shortcode problem’ is closed to new replies.