• In order to reduce loadtime on mobile I do not want to load an wppa-album on initial pageload but I want to put it ‘behind’ a button. So on buttonclick I execute “$.get({url: ‘https://www.magoster.nl/php/photo.php?func=wppa_slide&albumnr=1’, cache: false })”.

    It returns the text ‘[wppa type=”slide” album=”1″ size=”auto”][/wppa]’ as could be expected. But is does not load/show the album itself. Can anyone help me how to then execute this wppa-code? The relevant javascriptcode is below.

    Cheers, Rudolph Smits

    In webpage javascript:
    $.get({url: ‘https://www.magoster.nl/php/photo.php?func=wppa_slide&albumnr=1’, cache: false })
    .done(function( resultaat_get ) {
    PhoneBlock.innerHTML = resultaat_get;
    })
    .fail(function( err ){
    PhoneBlock.innerHTML = ‘<hr>Sorry, get failed…<hr>’;;
    });

    In photo.php:
    $function = $_GET[‘func’];
    $variables = $_GET[‘albumno’];
    $function($variables);
    function wppa_slide($albumnr) // $albumnr = not yet used
    {echo ‘[wppa type=”slide” album=”1″ size=”auto”][/wppa]’;}

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

Viewing 15 replies - 1 through 15 (of 26 total)
  • In my humble opinion you will have to call a WordPress page with your shortcode inside, because the shortcode needs to be processed. I think, the page should not have any sidebars, header and footer. Have a look at the shortcode [wppa type=”landing”][/wppa], you can use parameters in the url, to customize the result (for example ?wppa-album=1). That’s important, if you want to have dynamic content, because you can not use any php code inside the WordPress page without an additional plugin.

    You can get the data of that page with ajax and display them in a div or iframe tag. That’s what I would try.
    Happy coding!

    • This reply was modified 7 years, 4 months ago by FGBmaster.
    Thread Starter Rudolph Smits

    (@rudolph-smits)

    FGBmaster, thanks! I understand the way you are thinking but it will need some effort from me to make this work. This week I am going to try this and when it works I will put my solution in this thread below.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    The following example is a construction that will work: See This page on my dev site
    (Use the text editor, not the visual!! when you enter such code in the page or post):

    <div id="wppa-container-1"></div>
    <input type="button" value="MyButton" onclick="wppaDoAjaxRender( 1, 'https://mysite.com/wp-content/plugins/wp-photo-album-plus/wppa-ajax-front.php?action=wppa&wppa-action=render&wppa-size=640&wppa-moccur=1&wppa-fromp=10495&wppa-album=24&wppa-slide&wppa-occur=1' )" />
    [wppa type="landing"][/wppa]
    

    Assuming the output will come as first wppa thing on the page.
    The first argument in wppaDoAjaxRender() is the ‘master occurrance’ i.e. the sequence number of wppa shortcode on the page that will be used. Here is no shortcode; use: 1
    This number is also the 1 in id=”wppa-container-1″. We use the div in stead of the shortcode.
    The second arg is the ajax url and also contains the 1 twice: &wppa-moccur=1 and &wppa-occur=1. Keep these in!
    Also: the ajax url starts with:
    http(s)://mysite.com/wp-content/plugins/wp-photo-album-plus/wppa-ajax-front.php?action=wppa&wppa-action=render
    Change mysite.com into yours. and add the wppa display specs like:

    &wppa-size=640&wppa-moccur=1&wppa-fromp=10495&wppa-album=24&wppa-slide&wppa-occur=1
    

    size is the initial columnwidth, fromp the page or post id.
    In the example album 24 will be shown as slideshow: &wppa-album=24&wppa-slide

    Hope this helps. No coding, just ‘enhanced’ page content.

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    Thanks once again Mr Breetvelt, I will try to make this work!

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    BTW: The dummy shortcode [wppa type="landing"][/wppa] is not actually used (it is only used when the page is called with a querystring) but it is there to keep the internal occurrance counters correctly.

    Do not hesitate to ask me further help if you can not get it working!

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    Dear Mr Breedvelt

    First let me clarify want I try to do. The homepage of https://www.magsoter.nl now loads an album with 15-20 photo’s on pageload. However, to show this album a buttonclick Photo’s is necessary which is not always chosen. Therefor I want to load the album ONLY when this button has been chosen.

    I had to remove the &xxx; codes in your html because it did not work for me. So it is now:

    <div id=’wppa-container-1′></div>
    <input type=’button’ value=’MyButton’ onclick=’wppaDoAjaxRender( 1,”https://www.magoster.nl/wp/wp-content/plugins/wp-photo-album-plus/wppa-ajax-front.php?action=wppa&wppa-action=render&wppa-size=640&wppa-moccur=1&wppa-fromp=8049&wppa-album=1&wppa-slide&wppa-occur=1&#8243;)’ />
    <br />
    <br />
    landing here under:<br /><br />[wppa type=’landing’][/wppa]

    The only change I made is &wppa-fromp=8049 where 8049 is the wordpress pagenumber.

    The result on buttonclick is a page-not found for https://www.magoster.nl/undefined.

    What do I do wrong?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I do not see MyButton on https://www.magoster.nl/

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    No, you are right. This testpage hasn’t been published. The site was mentioned so that you could see what I mean with “show album on buttonclick” as it is now.

    Do you think it is necessary to see that testpage? I can make one on an other site on a page that is not indexed by Google bots.

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    OK, I implemented a better -temporary – solution.

    This is the testpage: https://www.magoster.nl/dank-voor-uw-boeking/

    The result is https://www.magoster.nl/dank-voor-uw-boeking/undefined/.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Ajax must be enabled in Table IV-A1.0, otherwise it defaults to a pageload, using the third arg in wppaDoAjaxRender() that is not there (because we do not need it)

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    Before I dare to do so, doesn’t that influence the right functioning as it is now? I do not have a test environment so any saved change gets visible for “the rest of the world”. So, I want the album to remain showing as it does now, as long as I am in a test & learning phase.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Np problem. This just affects the way how wppa internal links work

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    If you can wait a few days, i will make it a standard shortcode option.
    Please tell me the shortcode that you use currently, so i can make sure it will work in your case.

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    This is the code:
    echo ‘<div class=”menu_block” data-block=”2″><br /><br /><br />
    [wppa type=”slide” album=”1″ size=”auto”][/wppa]</div>’;

    I show the complete echo-statement deliberately because I want to be able to have content (here: the album) in a specific division. With $functions .hide and .show this (and other content divisions) are hided or shown on buttonclick.

    I hope this doesn’t make it more complex?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    No it doesn’t.

    I will make the button="..." shortcode option to work, so you will get the result you want when you change the shortocode from:
    [wppa type=”slide” album=”1″ size=”auto”][/wppa] into:

    
    [wppa type=”slide” album=”1″ size=”auto” button="MyButtonLabel"][/wppa]

    As simply as that.
    I will inform you when this feature is released, i expect sometime during next week.

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘$.GET wwppa’ is closed to new replies.