Forum Replies Created

Viewing 10 replies - 16 through 25 (of 25 total)
  • Thread Starter LeRedac

    (@leredac)

    I have try to install in the new worpress, it’s work.

    Maybe it’s conflict whith another plugins or conflict whith the theme.

    I’m search, and back here when y now what is the problem.

    Sorry for my english, is bad

    Thread Starter LeRedac

    (@leredac)

    And for if you put :

    <script src='https://maps.googleapis.com/maps/api/js?sensor=false' type='text/javascript'></script>

    directly on the page template , is not nescesery put this in header.php

    Or

    if you put script on the header.php is not nescesery put this in your template page

    Thread Starter LeRedac

    (@leredac)

    Hi James, are you sure the value >> get_field(‘google-map’); is not empty ?

    Try this code for testing return value :

    echo '<pre>';
        print_r( get_field('google-map')  );
    echo '</pre>';

    Inside ACF are you make a field whith name “google-map” ?

    Thread Starter LeRedac

    (@leredac)

    selfagency it’s same, just put a code in your single.php and d’ont forget add this directly inside or in your header.php >>

    <script src="https://maps.google.com/maps/api/js?sensor=false"
              type="text/javascript"></script>

    If you whant display map on a specific single page , use Function Reference/is single

    Sorry people, my english is bad ??

    Forum: Hacks
    In reply to: Custom post query

    maybe to help other perssones ??

    $value= 'YOUR QUERY TAXONOMY';
    $replace = str_replace('XYZ' ,'',$value);
    echo $replace ;

    Try java script

    First :

    • Make a form whith plugin, and add hidden field

    For exemple after display the form on your blog you see :

    <input type="hidden" value="" id="12_element25" name="name" />
    <input type="hidden" value="" id="13_element25" name="mail" />
    <input type="hidden" value="" id="14_element25" name="password" />

    the id off this field is : 12_element25 and 13_element25 and 14_element25

    • and, display your form whith php everywhere you whant in your theme : page.php or single.php etc …
    <?php echo Form_maker_fornt_end_main('[Form id="25"]'); // Display form
    ?>
    • And juste after put this :
    <script type="text/javascript">
    var formUrl = "<?php $_POST['name']; ?>";
    var formUr2 = "<?php $_POST['mail']; ?>";
    var formUr3 = "<?php $_POST['password']; ?>";
    document.getElementById('12_element25').value=formUrl;
    document.getElementById('13_element25').value=formUr2;
    document.getElementById('14_element25').value=formUr3;
    element.setAttribute("value", "sample value");
    </script>
    • Open Chrome Developer Tools and see result (work for me)

    Try

    <?php echo Form_maker_fornt_end_main('[Form id="25"]');?>

    Thread Starter LeRedac

    (@leredac)

    Ok this exemple if you whant display on a wordpress page, a Google Maps whith Multiple Markers (working whith WordPress 4.0 )

    This is my method, not sur it’s the best ! Trie.

    Is working if you make a custom post type like “Map” and add custom field google map white ACF

    1- Make a new templates page >> Exemple PAGE name >> MAP in your theme >> page-map.php
    2 – Create a new page in WordPress dashboard >> Exemple >> MAP
    3- d’ont forget put on your header google map script

    <script src="https://maps.google.com/maps/api/js?sensor=false"
              type="text/javascript"></script>

    4 – Choice your template page >> MAP
    5 – Publish your page and see result

    This is exemple off MAP page (put your <div> inside)

    <?php
    /*
    Template Name: MAP
    */
    get_header();
    ?>
    <h1><?php the_title(); ?></h1>
    
    <section>
    
    <?php
      $args = array(
    	  'post_type'		=> 'YOUR_CUSTOM_POST_TYPE',
    	  'posts_per_page'	=> -1
      );
    // query
    $wp_query = new WP_Query( $args );
    $NUM = 0;
    ?>
    
      <div id="map" style="width: 500px; height: 400px;"></div>
    
    <script type="text/javascript">
        var locations = [<?php while( $wp_query->have_posts() ){
    	$wp_query->the_post();
        $location = get_field('carte_google'); // IMPORTANT << Change this for your Google map field name !!!!!!
    ?>
    
    ['<?php the_title(); ?>', <?php echo $location['lat']; ?>, <?php echo $location['lng'];?>, <?php $NUM++ ?>],
       <?php } ?> ];
    
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 9, /*Here you change zoom for your map*/
          center: new google.maps.LatLng(-21.1, 55.6), /*Here you change center map first location*/
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });
    
        var infowindow = new google.maps.InfoWindow();
    
        var marker, i;
    
        for (i = 0; i < locations.length; i++) {
          marker = new google.maps.Marker({
            position: new google.maps.LatLng(locations[i][1], locations[i][2]),
            map: map
          });
    
          google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
              infowindow.setContent(locations[i][0]);
              infowindow.open(map, marker);
            }
          })(marker, i));
        }
     </script>
    </section>
    <?php get_footer(); ?>
    Thread Starter LeRedac

    (@leredac)

    Hi James,

    are you sure the value get_field(‘laama_map’); is not empty ?

    Try this code for testing return value :

    echo '<pre>';
        print_r( get_field('laama_map')  );
    echo '</pre>';

    Merci beaucoup evrenk pour cette astuce !!! j’était en train de me prendre le choux grave sur cette histoire de uft8. J’ai moi aussi une base de plus de 4000 enregistrement à importer dans un post type ! La ac Notpad ++ ?a marche nickel !

    smackcoders, i’m confirm Your plugin is a blessing !! Thank you so much ??

Viewing 10 replies - 16 through 25 (of 25 total)