WPMU – How to echo only one URL

Ok I was able to eventually figure it out, what I did was exclude the main blog from the code. <?php if(current_user_can( ‘edit_posts’ )) { global $current_user; $blogs = get_blogs_of_user( $current_user->id ); if($blogs) { foreach ( $blogs as $blog ) { if($blog->userblog_id != 1) { echo ‘<li><a href=”http://’ . $blog->domain . $blog->path .’upload-and-manage-documents/”>My Documents</a></li>’; echo … Read more

Open WordPress Page from selected option dropdown

Looks like not many folks do this. Anyway here’s something that works for me to get drop-down select to go to WordPress page” <?php $my_title = $_POST[‘place’]; global $wpdb; $mypost = $wpdb->get_row( “SELECT * FROM wp_posts WHERE post_title=”” . $my_title . “” ” ); $permalink = get_permalink($mypost->ID); echo “<a href=$permalink><BR>Click Here to Go to Selection</a>”; … Read more

Insert into db with foreach problem

(See comments) $wpdb->insert( ‘produse’, array( ‘id’ => $post_id, ‘pret’ => $produs[‘pret’], ‘gramaj’ => $produs[‘gramaj’], ‘numar_produs’ => $produs[‘numar_produs’] ), array( ‘%d’, ‘%s’, ‘%s’, ‘%d’ ) );

Millennial Media PHP Setup ( Code Integration )

I would not put that code into the theme. Create a plugin with the following content: <?php /* Plugin Name: Millennial Media Ads */ add_action( ‘show_ads’, ‘mma_show_ads’ ); function mma_show_ads() { # copy your PHP code into this function. } In your theme choose the place where you want to show the ads and write: … Read more

Category slug inside another php code

There is no need for any kind of (single or double) quotations: … ‘base’ => $cat, … about quotations: https://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php

Get Products within Current Product Category

You said you are able to get current product category name, store it in $current_product_category variable now try this code .. <ul class=”products”> <?php $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 1, ‘product_cat’ => $current_product_category, ‘orderby’ => ‘rand’ ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?> … Read more