post/page content

You need to apply the filter the_content e.g.: <?php echo apply_filters(‘the_content’,$home_page->post_content); ?> Also, you don’t need custom shortcodes for youtube, just put the URL in the content (but not a hyperlink), and it’ll be swapped out for a youtube player at runtime. No plugins or extra code needed thanks to oembed.

How to create a list of links to post with specific category

You can do this by putting this where you want to display the list : <ul> <?php global $post; $args = array( ‘numberposts’ => 10, ‘offset’=> 1, ‘category’ => 1 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li><a href=”https://wordpress.stackexchange.com/questions/50228/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> In … Read more

Does “Custom Post Type” can have page hierarhy option?

You can set a post type to hierarchical when you register it with register_post_type. Simply set the ‘hierarchical’ argument to true. $args = array( ‘public’ => true, ‘publicly_queryable’ => true, ‘has_archive’ => true, ‘rewrite’ => true, … ‘hierarchical’ => true, … ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’,’page-attributes’ ) ); register_post_type(‘my-cpt’,$args);

Making a wordpress page print friendly

remove_filter( ‘the_content’, ‘printme_add_link’ ) will prevent the link from being placed. You can just call printme_add_link() in your template to generate the print button. Alternately, you can just add_query_arg( ‘print’, 1, get_permalink() ) and use that as the link if you would prefer to do the link some different way.

sort posts by getPostViews in functions.php

You can use what you currently have and add a new condition: function sorter($wp_query) { if(mysql_real_escape_string($_REQUEST[“sorting”]) == “date”){ usort($wp_query->posts, ‘cmp_date’); }elseif(mysql_real_escape_string($_REQUEST[“sorting”]) == “title”){ usort($wp_query->posts, ‘cmp_alpha’); }elseif(mysql_real_escape_string($_REQUEST[“sorting”]) == “views”){ //create a list of all post ids as an array $ids = array(); foreach ($wp_query->posts as $p) { $ids[] = $p->ID; } //the query these posts again … Read more