show category in woocommerce

within a category you can use get_queried_object() to get data on the current category. $current_category = get_queried_object(); $args = array( ‘categories’ => $current_category->term_id ); $tags = get_category_tags( $args );

How to enable WPML in BuddyPress Multilingual Plugin in a single website? [closed]

On BuddyPress Multilingual you can read: This plugin requires WPML. It uses WPML’s language API and hooks to BuddyPress to make it multilingual. You need to have WPML installed for BuddyPress Multilingual to function correctly. Also, Buddypress Multilingual is for Buddypress sites. If you want to make your WordPress site multilingual, my advice is to … Read more

Create a link which allows visitors to disable a plugin?

According to the code … // Embed Switch Links in Theme Via Shortcode // [show_theme_switch_link] function show_theme_switch_link_func( $atts ){ $desktopSwitchLink = get_option(‘show_switch_link_for_desktop’); global $shown_theme; global $status; if ($shown_theme){ $return = ‘<a rel=”external” data-ajax=”false” href=”‘.get_bloginfo(‘url’).’?am_force_theme_layout=desktop” class=”am-switch-btn godesktop”>’.get_option(‘desktop_view_theme_link_text’).'</a>’; } else { if ((!empty($status)) || ($desktopSwitchLink == ‘yes’)){ $return = ‘<a href=”‘.get_bloginfo(‘url’).’?am_force_theme_layout=mobile” class=”am-switch-btn gomobile”>’.get_option(‘mobile_view_theme_link_text’).'</a>’; } } return $return; … Read more

Call javascript functions from each page

I would create a custom field containing the function to be called, for example called ‘function_to_call’. In the templatefile add the code $function_to_call = get_post_meta( get_the_ID(), ‘function_to_call’, true ); if ( $function_to_call != “” ) { echo ‘ jQuery(document).ready(function($){ ‘ . $function_to_call . ‘() }); ‘; } Doing this only outputs the function if you … Read more

Make get_permalink() work outside the Loop using filters

I made an example plugin based on Milo’s answer to show how you can use ajax to get a post and display it with colorbox. example.php: <?php /* Plugin Name: example */ function example_ajax_get_post() { $url = $_POST[‘url’]; $post = get_post(url_to_postid($url)); ?> <h2><?php print $post->post_title; ?></h2> <div><?php print $post->post_content; ?></div> <?php die(); }// end function … Read more

JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly

Save your JavaScript code out to a separate file within your plugin directory. Then use this code to load the file using the wp_enqueue_script() function. function smooth_scrolling_links() { if ( !is_admin() ) { // Don’t load if in the admin screen wp_enqueue_script(‘Smooth-Scolling-Links’, plugin_dir_url(__FILE__) .’-YOURFILENAME-.js’); } } Obviously replace the -YOURFILENAME- with the file name that … Read more