Set variable in javascript and using in my shortcode
Hey Guys i got the solution. just include my script in footer instead of header. add_action(‘wp_footer’, ‘spyrowebs_gmap_enqueue_scripts’);
Hey Guys i got the solution. just include my script in footer instead of header. add_action(‘wp_footer’, ‘spyrowebs_gmap_enqueue_scripts’);
I do not have enough rep to add a comment so I have to post an answer. Could you post the footer with and without those changes? This way we can see what you did to the file. Are you sure the website has not cached it’s self for you and you are seeing an … Read more
You arent clear where you want your else statement, so Ive added one for each of the if’s you included. <?php $post_type=”post”; // <– Post Type $tax = ‘temporada’; // <– Taxonomía $termino = get_terms($tax); $category = get_the_category(); $cat_name = $category[0]->cat_ID; if ($termino) { foreach ($termino as $temporada) { $args=array( ‘post_type’ => $post_type, “$tax” => … Read more
I found a solution with a recursive function function decomposePrice($base, $iValue, $values, $prices) { $d = array(); foreach ($prices as $i => $p) { $baseP = “$base{$values[$iValue][$i]}|”; if (!is_array($p)) { $d[$baseP] = $p; } else { $d = array_merge($d, decomposePrice($baseP, $iValue + 1, $values, $p)); } } return $d; } $decomposePrice = decomposePrice(“”, 0, $v_values, … Read more
I am not exactly sure what you are trying to do. However, in the second line of code you have a closing bracket at the end, but there is no opening bracket in your code. Maybe that’s the problem?
One solution might be to directly restrict access to the file on the server, but utilize a url rewrite to display the content — only if the id matches in the request. Obviously this doesn’t answer every question in the scenario but it does provide a proof-of-concept to indirectly convert a url into a file. … Read more
First step is to register the name (or names) for your menus. In your example, top-nav seems appropriate. function vd_register_menu() { register_nav_menu(‘top-nav’,__( ‘Top Nav Menu’ )); } add_action( ‘init’, ‘vd_register_menu’ ); This will allow you to build your menu items in the WP admin under Appearance > Menus. To display your menu on the site, … Read more
query_posts() can alter the WP query even when it is executed and it should be placed at least before you start the loop i.e. have_posts(). Currently you are placing it after setting up post data i.e. the_post(). Which is resulting in unexpected behavior. Example: global $query_string; //Get current query arguments query_posts($query_string.”&featured=yes”); if (have_posts()) { while … Read more
The PHP modulus operator gives you the remainder from dividing 2 numbers. The remainder from the division of any number by two is either 0 or 1, so we can use that to provide an “alternator”. We use the current_post var as a counter, which is available in any WP_Query object: while( have_posts() ){ the_post(); … Read more
WordPress errors are application level errors. PHP errors are language syntax or usage errors and appach error are errors detected during the web server operation. Errors, especially minor ones, might be reported “upwards” and look like they are wordpress application errors, or logged downwards and be part of the apache server error log if the … Read more