Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author shauno

    (@shauno)

    Hi khalid

    You should be able to do that. You will need to create the custom field that will have the shortcode saved in it. For this example, we will call that field “Download Manager Shortcode”. Then you need to save the shortcode in that field as you would normally use it in the editor, for example [wpdm_file id=2] (or whatever the shortcode is you want to use).

    Then, when outputting that custom field in the gallery template, you need to wrap it in a do_shortcode() call, like this:

    <?php echo do_shortcode($image->ngg_custom_fields["Download Manager Shortcode]); ?>

    I haven’t tested this yet, but in theory it should work ?? If it doesn’t let me know and I can investigate why.

    Thread Starter khalid farooq

    (@khalid-farooq)

    yes everything working fine,u are owsome developer,but with quotations inside shortcode like this,
    <?php echo do_shortcode($image->ngg_custom_fields[“Download Manager Shortcode”]); ?>
    thanks.

    Thread Starter khalid farooq

    (@khalid-farooq)

    1 thing more,i want to show game link in address bar,when i click on game link,just file downloads,link doesn’t change in address bar,i want to show link of file in address bar.

    AJ

    (@permaculturetreegeek)

    Thanks for this, have been searching everywhere.

    I was trying to add an mp3 player shortcode inside the custom field of nextgen gallery.

    AJ

    (@permaculturetreegeek)

    … almost working but having issues. (resolved)

    In the ‘additional-info’ field for each image, created with your plugin I have this shortcode:
    [mp3-popout tracks=”FEED:/music/home/mp3″] (mp3 jplayer plugin)

    I also had added the same mp3 shortcode onto the page itself, just to make sure the code works.

    Like this:
    [nggallery id=1 template=wp-eStore]
    [mp3-popout tracks=”FEED:/music/home/mp3″ ] (It does work.)

    In my wp-eStore template for the nextgen gallery I added the following code after the ‘caption’ in the foreach loop:

    <?php echo $image->ngg_custom_fields[“additional-info”]; ?>
    <?php echo do_shortcode($image->ngg_custom_fields[“additional-info”]); ?>

    The problem is that the shortcode is first printed exactly like this: [mp3-popout tracks=”FEED:/music/home/mp3″] (not parsed),and just below it is the parsed mp3 player popout icon.

    But, when I remove the test shortcode that I had added from the page itself (The player appears at the bottom of the page.), it stops parsing in the ‘additional-info’ field also.

    I’ve tried different variations.
    If I call the ngg_custom_field like this without the echo,
    <?php $image->ngg_custom_fields[“additional-info”]; ?>, it removes the unparsed shortcode.

    But I can not get it to parse in the ngg custom field without also adding it to the bottom of the page.


    Ok, I figured it out and am going to post in case it helps someone else. Its not a problem with the custom field plugin, but that my mp3 player plugin was not inserting its javascripts on the page unless it was included in the page itself. The mp3 plugin must be watching page content and selectively inserting the javascripts on pages that call its shortcode. I just have to selectively call the right javascripts on the gallery page and it works.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘want to use shortcode of 1 pluign in other’ is closed to new replies.