problem with ajax and the path to the php page

To use the WordPress ajax url you can pass the var using wp_localize_script: wp_enqueue_script( ‘functions’, get_bloginfo( ‘stylesheet_directory’ ) . ‘/js/functions.js’, array( ‘jquery’ ), false); wp_localize_script( ‘functions’, ‘MyAjax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) ) ); In your functions.js $.ajax({ type: “POST”, url: MyAjax.ajaxurl, data: {p:alt_p}, success: function(data) { alert(data); } });

Why is my custom meta box input not saving

Try changing: <input class=”widefat” type=”text” placeholder=”[galleryview id=X]” name=”rs-job-gallery” id=”rs-job-gallery” value=”<?php echo esc_attr( get_post_meta( $object->ID, ‘rs_job_gallery’, true ) ); ?>” size=”30″/> to this: <input class=”widefat” type=”text” placeholder=”[galleryview id=X]” name=”rs_job_gallery” id=”rs-job-gallery” value=”<?php echo esc_attr( get_post_meta( $object->ID, ‘rs_job_gallery’, true ) ); ?>” size=”30″/> Reason: When the “name” attribute is set in the input field, that becomes the $_POST[‘input_name’] … Read more

Adding Custom Fields for Img in Posts

You should use the post thumbnail feature. Add support for this feature with this line in your functions.php file: add_theme_support( ‘post-thumbnails’ ); You can also set a new thumbnail size that will be cropped on new added photos to use this in your theme. Add this code to set a new thumbnail size (also in … Read more

WordPress category loop offset possible?

The ‘offset’ parameter does what you want. I’ve written this hack, it should help you… <?php //The third parameter corresponds to action priority, //set it to change the order of execution in case of a conflict add_action(‘pre_get_posts’, ‘the_modified_loop’, 10); function the_modified_loop($query){ //Remove ‘is_admin’ if you want the code to run for the backend category archive … Read more

Drop down+sort blog posts date added/most popular

Yes, we can sort WordPress posts in different orders, You can do following sorts without installing plugins. sort post by date ( ascending / descending ) Sort post by title (ascending / descending ) Sort post by comment count ( ascending / descending ) — These are just basic we can do even more using … Read more

wp_customize_image_control default value

I had the same problem a few minutes ago. Here is what I used in the src tag: <?php if (get_theme_mod( ‘custom_logo_image’ )) : echo get_theme_mod( ‘custom_logo_image’); else: echo get_template_directory_uri().’/inc/images/default_logo.png’; endif; ?> It seemed to solve my problem. Let me know if it works for you.

Does WordPress cache get_user_meta() results?

Yes, it does. That function is a wrapper for get_metadata(). Inside of that you can find: $meta_cache = wp_cache_get($object_id, $meta_type . ‘_meta’); if ( !$meta_cache ) { $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); $meta_cache = $meta_cache[$object_id]; }