Title: Karimeo's Replies | WordPress.org

---

# karimeo

  [  ](https://wordpress.org/support/users/karimeo/)

 *   [Profile](https://wordpress.org/support/users/karimeo/)
 *   [Topics Started](https://wordpress.org/support/users/karimeo/topics/)
 *   [Replies Created](https://wordpress.org/support/users/karimeo/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/karimeo/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/karimeo/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/karimeo/engagements/)
 *   [Favorites](https://wordpress.org/support/users/karimeo/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Can we validate data from jquery](https://wordpress.org/support/topic/can-we-validate-data-from-jquery/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/can-we-validate-data-from-jquery/#post-9095129)
 * It is Ok, as long as you also validate it server side with PHP before saving 
   it 🙂
 * JavaScript validation can be easily circumvented if wanted. It is useful for 
   giving the user faster feedback if the data he entered was correct or not (Without
   needing to send the data to the server, validate it there and wait for the response).
   However, as JavaScript runs client side, it can easily be manipulated so you 
   shouldn’t rely on it for security. You should also do validation server side.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Varying div class in WordPress](https://wordpress.org/support/topic/varying-div-class-in-wordpress/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/varying-div-class-in-wordpress/#post-9095103)
 * Hello,
 * Here is an example of how you could accomplish this sort of thing in the loop:
 *     ```
       $counter = 0;
       while ( have_posts() ) : the_post();
   
           $counter++;
           if( $counter % 3 === 0 ) :
       	?>
               <div class="col-md-3 col-sm-6" style="position: absolute; left: 0px; top: 0px;"> <!-- output your content --> </div>
           <?php else : ?>
               <div class="col-md-3 col-sm-6" style="position: absolute; left: 0px; top: 0px;"> <!-- output your content --> </div>
           <?php endif; ?>
   
       <?php endwhile; ?>
       ```
   
 * Basically you’re just incrementing a counter with every post that is being output.
   If the counter is divisible by 3 ( every third post ) you output one thing, if
   it’s not divisible by 3, you output another thing (3 can be replaced with another
   value of course).
 * A small variation, without using an extra variable for the counter :
 *     ```
       while ( have_posts() ) : the_post();
   
           if( ($wp_query->current_post + 1) % 3 === 0 ) :
       	?>
               <div class="col-md-3 col-sm-12" style="position: absolute; left: 0px; top: 0px;"> <!-- output your content --> </div>
           <?php else : ?>
               <div class="col-md-3 col-sm-6" style="position: absolute; left: 0px; top: 0px;"> <!-- output your content --> </div>
           <?php endif; ?>
   
       <?php endwhile; ?>
       ```
   
 * $wp_query->current_post always holds the index of the current output post in 
   the main loop. It starts with 0, that’s why we need the +1.
 * I hope this helps a little bit.
 * Regards,
    Karim.
    -  This reply was modified 9 years, 1 month ago by [karimeo](https://wordpress.org/support/users/karimeo/).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Hook function prints output twice](https://wordpress.org/support/topic/hook-function-prints-output-twice/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/hook-function-prints-output-twice/#post-9095059)
 * Hi Subrata,
 * The reason why the function attached to the Hook is called twice, is because 
   the Hook is actually executed twice 🙂
 * You don’t need to call to do_action(). do_action( ‘create_amenities’, … ) is 
   automatically called by WordPress in the wp_insert_term() function.
 * You would only use do_action() if you want to create your own Hook. In this case,
   you’re not creating a Hook. You’re attaching to an existing Hook offered by WordPress.
 * I hope this helps you.
 * Regards,
    Karim.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to edit a page that is using a template](https://wordpress.org/support/topic/how-to-edit-a-page-that-is-using-a-template/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/how-to-edit-a-page-that-is-using-a-template/#post-9092164)
 * The content of the page may be hard-coded in the corresponding file. Look into
   your theme’s folder (wp-content/themes/THEME-NAME) for a .php-file having a similar
   name to the name of the template. The content of the file should start with :
 *     ```
       /**
        * Template Name: TEMPLATE NAME
       ```
   
 * “TEMPLATE NAME” is, of course, to be replaced with the name your template has.
   You can make a copy of that file and name it slightly differently ( both filename
   and the comment at the top of the content ). That way you would have a new Template
   in which you can safely try your customization on.
    -  This reply was modified 9 years, 1 month ago by [karimeo](https://wordpress.org/support/users/karimeo/).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [problem to install ver 4.7.4](https://wordpress.org/support/topic/problem-to-install-ver-4-7-4/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/problem-to-install-ver-4-7-4/#post-9092121)
 * You can deactivate the plugin by FTP. You just need to rename the folder “wp-
   content/plugins/video-central” to something else like “wp-content/plugins/video-
   central_backup” for example.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Where is this widget pulling code from?](https://wordpress.org/support/topic/where-is-this-widget-pulling-code-from/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/where-is-this-widget-pulling-code-from/#post-9085915)
 * Hello,
 * The ads are injected using JavaScript into that div with id=”placehholderdiv”.
 * The JavaScript Code that is responsible for this is injected into the header 
   of your site. Now it’s difficult to say, where your web guy did write that code.
   You can look into your theme’s header.php file ( can be found in wp-content/themes/
   THEME-NAME/header.php ) or take a look into wp-content/themes/THEME-NAME/functions.
   php . Here’s to what the code resembles : [https://puu.sh/vCce9/a303190337.png](https://puu.sh/vCce9/a303190337.png).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Filter by category](https://wordpress.org/support/topic/filter-by-category-20/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/filter-by-category-20/#post-9085320)
 * Hello,
 * You can make use of the template loading hierarchy of WordPress to have a different
   output for a specific category.
 * In you’re example you would create a category-commercial.php file and put your
   specific code in there. This page will be loaded instead of archive.php for that
   specific category.
 * For more informations about the template hierarchy take a look here : [https://developer.wordpress.org/themes/basics/template-hierarchy/](https://developer.wordpress.org/themes/basics/template-hierarchy/).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Can’t find a way to load my script after Google Maps API](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/#post-9079037)
 * You can put it in you functions.php and then in the function wrap the enqueues
   in an IF-Statement that uses a Conditional-Tag. The is_page_template() [https://developer.wordpress.org/reference/functions/is_page_template/](https://developer.wordpress.org/reference/functions/is_page_template/)
   might be usefull here. That way the scripts only get loaded on that specific 
   template.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Output latest posts from each child categories of particular parent category](https://wordpress.org/support/topic/output-latest-posts-from-each-child-categories-of-particular-parent-category/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/output-latest-posts-from-each-child-categories-of-particular-parent-category/#post-9077581)
 * These are posts from different queries. The orderby parameter sorts the results
   of one query. Maybe the easiest way to do it would be to collect the posts for
   each parent category in an array and then sort them manually (according to their
   date) before outputting them.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Can’t find a way to load my script after Google Maps API](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/#post-9077483)
 * The code you’ve posted looks correct for me. Maybe you’ve put it somewhere where
   it doesn’t get executed or where it gets executed after the wp_enqueue_scripts
   is already done. Try to put it in your theme’s functions.php (We’re talking about
   frontend, correct?).
    -  This reply was modified 9 years, 1 month ago by [karimeo](https://wordpress.org/support/users/karimeo/).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Can’t find a way to load my script after Google Maps API](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/#post-9076244)
 * Hi,
 * The dependance parameter in wp_enqueue_script makes sure that the script with
   the handle ‘gmap_metierville_script’ gets loaded after the script with the handle‘
   google-maps’. Also ‘google-maps’ is loaded in the header and ‘gmap_metierville_script’in
   the footer. So even without the dependance it should get loaded after.
 * Try excuting the Code in your custom script after the document.ready event. So
   it might look something like this:
 *     ```
       jQuery(document).ready(function( $ ) {
   
         //Create the map
         //Add Markers
         //...
   
       });
       ```
   
    -  This reply was modified 9 years, 1 month ago by [karimeo](https://wordpress.org/support/users/karimeo/).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Can’t find a way to load my script after Google Maps API](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/cant-find-a-way-to-load-my-script-after-google-maps-api/#post-9074876)
 * Hello,
 * You should always enqueue your scripts with wp_enqueue_script(). Also I’m not
   sure if you’re using this function correctly. It should be called on the ‘wp_enqueue_scripts’
   Hook. So you might use something like this:
 *     ```
       function prefix_enqueue_scripts() {
       wp_enqueue_script('google-maps', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAhE_CVUWwIOzXs-zD-vFdtgWBFWRBhQVY');
       wp_enqueue_script( 'gmap_metierville_script', get_stylesheet_directory_uri() . '/assets/js/google_map_metier_ville.js', array('jquery', 'google-maps'), SSO_VERSION, true);
       }
       add_action( 'wp_enqueue_scripts', 'prefix_enqeue_scripts' )
       ```
   
 * Notice that your script gmap_metierville_script is made dependent on google-maps
   so it will always get loaded after it. Also I removed the Callback-Parameter 
   from the API-Link. Just initialize your map at the beginning of gmap_metierville_script
   and do your stuff.
 * I hope this helps a little bit.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Get data from database for a widget](https://wordpress.org/support/topic/get-data-from-database-for-a-widget/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/get-data-from-database-for-a-widget/#post-9074786)
 * Hello,
 * The get_option() function might be what you’re looking for. [https://developer.wordpress.org/reference/functions/get_option/](https://developer.wordpress.org/reference/functions/get_option/)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Fatal error: Call to a member function do_all_hook()](https://wordpress.org/support/topic/fatal-error-call-to-a-member-function-do_all_hook/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/fatal-error-call-to-a-member-function-do_all_hook/#post-8526985)
 * This might be the same issue as in this topic: [https://wordpress.org/support/topic/fatal-error-call-to-a-member-function-do_all_hook-on-array-in/](https://wordpress.org/support/topic/fatal-error-call-to-a-member-function-do_all_hook-on-array-in/)
   Someone suggested in there that it might happen when PHP-APC is not activated.
   Try renaming your object-cache.php in the wp-content directory to see if this
   is the same problem. There is also an open ticket for this issue: [https://core.trac.wordpress.org/ticket/39146](https://core.trac.wordpress.org/ticket/39146)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Gallery Custom Links] Conflict with Jetpack carousel](https://wordpress.org/support/topic/conflict-with-jetpack-carousel/)
 *  [karimeo](https://wordpress.org/support/users/karimeo/)
 * (@karimeo)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/conflict-with-jetpack-carousel/#post-8525971)
 * Try adding add_filter( ‘jp_carousel_force_enable’, function( $input ) { return
   true; } ); to your functions.php

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