Problem enqueuing scripts on not single posts

With a couple minor modifications, I was able to run your function with your desired outcome (sitewide except on single post/cpt pages & in admin area). The current preferred method of returning the stylesheet uri is with the get_stylesheet_directory_uri(), not by using get_bloginfo(‘stylesheet_directory’): From the WordPress Codex Function Reference page: ‘stylesheet_directory’ – Returns the stylesheet … Read more

Custom meta box in custom post type not working

Hey Change Callback function to like this and add_meta_box to add_meta_boxes hook function create_meta_box_slider() { add_meta_box( ‘new-meta-boxes-slider’, __(‘slider Settings’), ‘new_meta_box’, ‘slider’, ‘normal’, ‘high’ ); } add_action(‘add_meta_boxes’, ‘create_meta_box_slider’); function new_meta_box() { global $meta_box_groups; $meta_box_groups[] = $slide_info; } I think it work fine

writing an unique php function to be used on my website

You are returning the translation in your function, not printing it. Using <?php echo date_translation(); ?> should solve the problem. (given that functions.php is initiated at the time you use the function) Edit: In order to follow WordPress convention, you should call the function get_date_translation(). If you want the function to echo the result instead, … Read more

How do I pull avatar from post using BuddyPress? [closed]

Try this: $author_id = get_the_author_meta(‘ID’); echo bp_core_fetch_avatar ( array( ‘item_id’ => $author_id, ‘type’ => ‘full’ ) ); Defaults: array( ‘item_id’ => false, ‘object’ => ‘user’, ‘type’ => ‘thumb’, ‘avatar_dir’ => false, ‘width’ => false, ‘height’ => false, ‘class’ => ‘avatar’, ‘css_id’ => false, ‘alt’ => ”, ’email’ => false, ‘no_grav’ => false, ‘html’ => true, … Read more

Creating customized php files in theme folder

Problem#1: You can create a customized php file for your page using a Page Template Page Templates WordPress looks for template files in the following order: Page Template — If the page has a custom template assigned, WordPress looks for that file and, if found, uses it. page-{slug}.php — If no custom template has been … Read more

Rewrite Question Mark in Post Template with URL Parameter for clean URLs

Your should add rewrite endpoint template on theme activation hook and init hook. Also there is some little checks to perform to prevent errors. function sjc_theme_activate(){ sjc_theme_add_rewrite_endpoint(); flush_rewrite_rules(); } //for more info http://codex.wordpress.org/Plugin_API/Action_Reference/after_switch_theme add_action( ‘after_switch_theme’, ‘sjc_theme_activate’ ); function sjc_theme_deactivate(){ flush_rewrite_rules(); } //for more info http://codex.wordpress.org/Plugin_API/Action_Reference/switch_theme add_action( ‘switch_theme’, ‘sjc_theme_deactivate’ ); function sjc_add_query_vars($vars) { $vars[] = ‘template’; … Read more

shorthand syntax for custom fields

You have a couple of flaws in your code get_post_meta( ‘fap_referral_link’ ) should be get_post_meta( $post->ID, ‘fap_referral_link’, true ). Please see get_post_meta() You should always first check if you actually have posts before you run your foreach loop Never ever use extract(). It uses eval() which stand for EVIL. This has been completely removed from … Read more

Function to limit number of custom post types on homepage – TwentyTen

This should do the trick: add_action( ‘pre_get_posts’, ‘add_tours_post_type_to_query’ ); function add_tours_post_type_to_query( $query ) { if ( is_home() && $query->is_main_query() ){ $query->set( ‘post_type’, array( ‘tours’ ) ); $query->set( ‘posts_per_page’, 1 ); } return $query; } For the future the Codex can be your friend. Exactly this is explained there.

Ajax resetting my global variable

Each time you’re making an ajax call, $_TEST = 0; is being evaluated again. You use the options API to manipulate your variable. function get_global_val() { $count = get_option( ‘mycount’ ); $count++; //or whatever you want to do with it update_option( ‘mycount’, $count ); die(“New value is $count”); }