Enqueue sripts and styles only if function is called
Instead of two functions, just put the gallery assets code inside of the portfolio gallery function. Or nest it. Nesting is kinda ugly though.
Instead of two functions, just put the gallery assets code inside of the portfolio gallery function. Or nest it. Nesting is kinda ugly though.
Declare menu_count = 0; before your foreach and then within your foreach you’ll need to include $menu_count++; and then you could add $menu_count as an attribute, or a label. You will need to make a custom function for this, so be sure to check out the codex on wp_get_nav_menu_items
Plugin function in child theme
You can pass wp_login_url() a URL to redirect to upon login. https://codex.wordpress.org/Function_Reference/wp_login_url If you used the 1st Solution, right before your exit;, you have the wp_redirect() call. You can replace that line with the following wp_redirect( esc_url( wp_login_url(get_permalink($page_id)) ), 307 ); and I would not use your second solution. Hope that helps!!
You could try something like: $url=”https://oc.com/api/v1/employees/?page=1″; $data = array(); while ( $url ) { $response = $this->request( $url ); $data = array_merge( $data, $response->data ); // if this is not the last page, get the next page URL if ( $response->paginator->current_page != $response->paginator->last_page ) { $url = $response->paginator->next_page; } else {$url = false;} } return … Read more
Create a temporal post
Your check is incorrect: right now, it tries to access $_POST[‘rating’], which might not be set, and then checks whether that value is empty. Furthermore, you should scope your if statement with brackets, because right now, your code will try and update the average rating even if no new rating is provided. Try: function save_comment_meta_rating( … Read more
I’m not sure I understand, nevertheless: Maybe you could instead try to trace back when the specific action from amazon plugin is registered. (lets call this hook_registration) And also the hook when your problem occurs, lets call this ( hook_execution ) So, just hook yourself anywhere between hook_activation and hook_execution, and, inside the function, you … Read more
You can use below code to hide add to cart & price for WooCommerce products in the ‘Services’ category. // Specific product category archive and shop pages add_action( ‘woocommerce_after_shop_loop_item_title’, ‘hide_loop_product_prices’, 1 ); function hide_loop_product_prices(){ global $product; if (! is_user_logged_in()) { if( is_product_category(‘services’) || has_term( ‘services’, ‘product_cat’, $product->get_id() ) ){ // Hide prices remove_action(‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 … Read more
The short answer is to use the location wp-content/languages/woocommerce/ to store custom translations. See WooCommerce documentation. This location should be safe from all WordPress updates. Folders parallel to languages/plugins and languages/themes will not be modified. To your specific questions: is there a way to make whole wp-content/languages folder safe for updating? You can control automatic … Read more