exec-PHP shows output at bottom of page

Create a shortcode and return the content instead of echoing it out so in your functions.php file add: function myFunc($atts,$content = null) { while (ture) { return $content; } return ”; } add_shortcode(‘myfunc’,’myFunc’); and in your page’s content instead of using exec-PHP just call your new shortcode: [myfunc]val[/myfunc]

How To Use Custom Fields With .mp3 Links

First you need to create that custom field and choose an apropriate name, then you can paste your link and save the post. After that, you must open your single.php file (or the file where you want the link to exist) and insert the following inside the loop: <?php //first i select which custom field … Read more

WordPress custom post type and taxonomy

As per Anand’s comment, something like this should work. <?php get_header();?> <?php $args = array( ‘post_type’ => ‘Video’); $loop = new WP_Query( $args ); $old_term = null; while ( $loop->have_posts() ): $loop->the_post(); $fg = get_the_terms(get_the_ID(),’category’); foreach($fg as $term): if ( $old_term === null || $old_term != $term ): $old_term = $term; ?> <h2><?php echo $term->name; … Read more

Setting a post’s category

Try doing this: $insert_post = wp_insert_post(array( ‘post_author’=>1, ‘post_date’=>date(‘Y-m-d H:i:s’), ‘post_date_gmt’=>date(‘Y-m-d H:i:s’), ‘post_content’=>”, ‘post_title’=>”, ‘post_excerpt’=>”, ‘post_status’=>’publish’, ‘comment_status’=>’closed’, ‘post_name’=>”, ‘post_parent’=>0, ‘post_type’=>’portfolio’, // with ‘portfolio’ custom post type ‘post_category’=>array($id), )); if( $insert_post ) { wp_set_object_terms( $insert_post, intval( $id ), ‘galleries’); } Using wp_set_object_terms you can set the terms for the post in any taxonomy. The first argument is … Read more

Don’t display a sidebar widget when on a specific page

Assuming that the ‘blog’ slug is correct, your code would work. I would suggest making a separate template for the page, namely page-blog.php (see http://codex.wordpress.org/images/1/18/Template_Hierarchy.png and http://codex.wordpress.org/Template_Hierarchy) where you set up the structure and appearance of the page exactly as you want it to be. WordPress will automatically look for the file when opening a … Read more

quotes problem in very simple sql

if you’re communicating with the WordPress database itself, try using $wpdb->prepare() on your select string before running it as $wpdb->query() – it should format it for you. Further reading: Codex