Forum Replies Created

Viewing 15 replies - 16 through 30 (of 30 total)
  • Thread Starter craigstanfield

    (@craigstanfield)

    Hi @westonruter,

    I’ve created a ticket in github as requested

    https://github.com/ampproject/amp-wp/issues/2512

    I’ve used yall (yet another lazy loader) with amp with no issues. You have to add a class of lazyload wherever its needed in non amp(ie any below fold images), you can even use it with css background picture video and other tags, that’s it and with amp the js doesn’t load and as it is a generic tag amp converts it.

    Ok I had a better look and it seems these images are lazyloaded, the js file handling this will be ignored by amp. I’m guessing this is not 1.1.x in transitional mode? theres a lot of differences between the original and amp pages, upgrading the plugin and putting it in transitional mode (middle option) this option allows amp pages to run using a ?amp suffix instead of amp but will fix most issues and use existing templates.

    @andrbarbieri Have you looked in the header file? I had this exact issue, turned out yoast was adding in one version the other was in the head section, I removed the one in the head section error gone…

    Forum: Reviews
    In reply to: [AMP] I am sick and tired

    I’ve been using this plugin since a baby too and the latest version (1.1.x) is much easier to work with, I used to have to develop all the templates to be specific for amp (i used a folder in my theme called amp-templates) this was a nightmare to maintain but now i work within the same workflow for the rest of the site and no more templates to track all the time. I find that the menu is always broken (no surprise really as theres 100’s of different ways to do a menu) but a simple snippet in the functions file fixes this, all i had to do was grab the id of the container and button and find the class that the site usually uses when the menu is opened/closed and voila. All other content is dealt with with no or very little effort.

    Between the use of the ‘test if page is amp and run this code otherwise that code’ and the menu fix you should be able to fix any issue i can think of. There are of course uses that are not what is normally expected but it is very easy to fix these by adding an amp script developed for this task (i’ve not had to since upgrading to 1.1.x but had a few i used in 0.7.2)

    I’ve also used a few other AMP plugins but this one is by far the easiest most time saving and best supported of any AMP plugin I’ve tried

    I’d highly suggest looking over this forum at similar issues you are having.

    Could you try your local cache please (Ctrl + F5 or Cmd + R for mac), I’m seeing images on that page

    Thread Starter craigstanfield

    (@craigstanfield)

    Thanks Aert,

    Look forward to the update of this great timesaving plugin!

    thanks

    Thread Starter craigstanfield

    (@craigstanfield)

    Thanks Pascal,

    I’ll get that in place. I had noticed this page while looking over docs but was thinking I may be able to reuse my old template. However if it’s worth doing it’s worth doing right.

    thanks

    Thanks aspenpc, saved my life, after getting a copy of the live site into my dev copy i got this in the backend. disabling plugins themes etc as from codex didn’t resolve this issue but renaming folder manually replacing wordpress and logging in and finally renaming plugins folder back (after deleting fresh copy) worked for me.

    Thread Starter craigstanfield

    (@craigstanfield)

    Hi wfalaa,

    Yes this script is being shown in the live traffic log. I found that adding the server ip we progressed further but it wasn’t until i changed the number of tries until throttle that i was able to get the data in. With this in mind I would need a method either to adjust these values for the small time this runs and set them back afterwards or to disable it temporarily, the job itself runs from a cron so having an operative log on at a quiet time to change settings and press buttons is far from ideal.

    Hi lenglemetz,

    to do this you will need to create a custom type in a function/plugin file

    add_action( ‘wpcf7_init’, ‘wpcf7_add_shortcode_drop’ );

    then create a function which creates the shortcode

    **
    * Add cf7 shortcode builder callup function
    */
    function wpcf7_add_shortcode_drop() {
    wpcf7_add_shortcode( ‘drop’, ‘wpcf7_drop_shortcode_handler’, true );
    }

    finally you can create the function which generates the dropdown in html

    function wpcf7_hide_shortcode_handler( $tag ) {
    $tag = new WPCF7_Shortcode( $tag );
    $id = get_the_ID();
    $location = get_the_title();
    $html = ‘<select required=”required” class=”form-control form-select required” id=”edit-submitted-besoin” name=”submitted[besoin]”>
    <option value=”” selected=”selected”>– Choisir –</option>
    <optgroup label=”Assurances de personnes”>
    <option value=”Mutuelle sante”>Mutuelle santé</option>
    <option value=”Prevoyance”>Prévoyance</option>
    <option value=”Dependance”>Dépendance</option>
    <option value=”Obseques”>Obsèques</option>
    <option value=”Assurance Vie”>Assurance Vie</option>
    </optgroup>

    </select>’;

    return $html;
    }

    this should help get you going, I cut and pasted part of the menu you wish to recreate, obviously you will need to get this data dynamically.

    Thread Starter craigstanfield

    (@craigstanfield)

    should point out we used

    $submission = WPCF7_Submission::get_instance();
    $wpcf7_data = $submission->get_posted_data();

    and used this but found no function to set_posted_data() so used $_POST is there a method to set the posted data?

    Hi ageibert,

    I’ve used the wpcf7_validate_api for this, first create a filter:
    add_filter(‘wpcf7_validate_api’, ‘validate_api’, 20, 2);
    now in this block you can get the values using:

    $submission = WPCF7_Submission::get_instance();
    $wpcf7_data = $submission->get_posted_data();

    you can then call you’re api (presumably with curl) and invalidate as follows (presume $success is from the api call)

    if (!$success) {
    $result->invalidate($tag, ‘api call_failed (statuscode:’ . $statuscode . ‘).’ . $statusdesc[0]);
    }

    and finally

    return $result

    hope this helps

    Thread Starter craigstanfield

    (@craigstanfield)

    Thanks Takayuki, after revisiting the link i worked out how to add a custom type of api which fixed my issue

    Thread Starter craigstanfield

    (@craigstanfield)

    Hi Takayuki,

    Ok interesting, but i wish to call the api after the form has been validated, that way the data is ok to begin with, mainly the api will fail if the site is down which means data is not backed up.

    Using the method on the link you supplied i was able to invalidate the form and show the api result beneath the email field, in my case there is no field for the api. I tried to create a custom type called api but hit issues, i also tried with submit validation which executed but failed to invalidate the form.

    So is there any way i can validate the form fields as normal but then if the data sent to the api fails we invalidate the form.

Viewing 15 replies - 16 through 30 (of 30 total)