How to show only a certain part of the entry title?

Hiding part of the title with CSS clipping (as the OP requested in the original unedited title) is almost certainly not the best way to accomplish this. Here is how to do this in the template file. If all of your titles will be formatted the same way (with a space, a hyphen, and a … Read more

Using shipped version of jquery

The jQuery library packed with WordPress, operates under noConflict mode. Means you can not use $ in your jQuery snippet/code. Either use jQuery instead of $. or use noConflict wrapper like this. <script type=”text/javascript”> <!– jQuery(document).ready(function($) { // your jquery function, you can use $ here. }); // –> </script>

How Can I Call Up The Author’s Name on a Post

Inside The Loop you can use the Template Tag the_author() to display or get_the_author() to return the same. For an introduction to outside the loop usage take a look at the Q&A’s at the thread How to get Author ID outside the loop on here.

how to save selection meta data in user profile on frontend

Ahh it turns out it wasn’t able to stay selected because I was using the “strtolower” function to remove capital letters. Which in turn caused there to be a mismatch between the selected value and the saved value in the database. add_action( ‘show_user_profile’, ‘product_selection_field’, 3 ); add_action( ‘edit_user_profile’, ‘product_selection_field’, 3 ); function product_selection_field( $user ) … Read more

How do i use this jquery script on a wordpress site?

Its pretty simple. First you have to add a function in your themes funcition.php file to register and enqueue your scripts in head using wp_enqueue_scripts hook. // Register and enqueue all scripts in head function custom_scripts() { wp_register_script( ‘script_googleapis’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js’, false, false, false ); wp_enqueue_script( ‘script_googleapis’ ); wp_register_script( ‘script_listjs’, ‘http://listjs.com/no-cdn/list.js’, false, false, false ); wp_enqueue_script( … Read more

Order posts randomly, not by date

$randomPosts = get_posts(array( ‘orderby’ => ‘rand’, ‘posts_per_page’ => 5, ‘tag’ => $tag, )); Take a gander at the WP_Query documentation. get_posts uses WP_Query under the hood, so you can use any arguments that may be used there.

Shortcode API: How to get name that matched shortcode RegEx?

I think you just forgot to run the shortcodes [foo a=”b”] and [bar a=”c”] through the do_shortcode filter: do_shortcode( ‘[foo a=”b”] [bar a=”c”]’ ) The output of the_content() is filtered through the do_shortcode, so you can just add it into your editor instead. Running your code I get the following output for the $arguments dump: … Read more

Problem adding class to body_class

You are using array_push() incorrectly. Do this: $classes[] = ‘new-class’; Or this: array_push( $classes, ‘new-class’ ); But not: $classes[] = array_push( $classes, ‘new-class’ );

How to Display a Single Post Excerpt

the_excerpt() is one of a few template tags that do not accept a post ID as a parameter. Instead, you need to set up the global $post, run your tags, then restore it: if ( $_post = get_post( 10 ) ) { setup_postdata( $post = $_post ); the_excerpt(); // Any other template tags for this … Read more