2 loops in blog homepage

You can use this code to get 3 posts from category Featured $args = array( ‘category_name’ => ‘featured’, ‘posts_per_page’ => 3 ); $featured_posts = new WP_Query( $args ); if ( $featured_posts->have_posts() ): while ( $featured_posts->have_posts() ): $featured_posts->the_post(); // Here you can use the normal loop functions like ‘the_title()’ to display your // 3 posts from … Read more

Link images to post

If you’re adding an image to your post via “Add Media,” you can simply set where you would like the image to link by setting it in the “Link to” field. If you’re adding an image to your post with “Featured Image,” you can add this to your template: <?php if ( has_post_thumbnail()) : ?> … Read more

Restrict access to certain dashboard pages based on user id

I would just disable the editor entirely. It is a dangerous tool anyway. I compare it to working on an airplane while its flying. Edit wp-config.php to add: define(‘DISALLOW_FILE_EDIT’,true); You can reverse that by re-editing your wp-config.php and uploading over FTP (or maybe you have direct file access), as you should be doing anyway, but … Read more

blank page with no code or errors on blog

Make sure to read over this thread. There are step-by-step instructions on dealing with sub-folders and root URLs. It’s not as simple as changing the settings in WP, you have to edit a couple files to make it work as well. http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Execute PHP code in Javascript onclick

In simple terms, window.location.href is javascript, and will run in the browser, but PHP runs on the server. In order to execute update_usermeta() you need to open a page with that block of code on it. The best way to do this from a click is to use AJAX (javascript) to visit the URL on … Read more