Remove the_content From Loop

I don’t see anything that would cause the_content() to display in your code. Chances are, the template file you are editing is NOT the one being used on the page/archive you are checking. Add this to the top of your template files… <!– Template: <?php echo __file__; ?> –> Now, in your web browser view … Read more

Changing 2011 theme header image based on user dropdown

I had to take information from both of your posts to be able to come with something. Try replacing <img src=”https://wordpress.stackexchange.com/questions/89211/<?php header_image(); ?>” width=”<?php echo $header_image_width; ?>” height=”<?php echo $header_image_height; ?>” alt=”” /> width <?php if (!(isset($_POST[“styles”]))) { //if post not set (first visit) if ($_COOKIE[“chosenStyle”] == “night”) { echo ‘<img src=”‘.get_template_directory_uri() . ‘/images/headers/SomethingOriginalTheMoonAndStars.png” width=”1000″ … Read more

How to echo a different field if another field is empty?

You might try to replace the foreach( $myCarousel as $carousel ) with: foreach($myCarousel as $carousel){ $myimg = get(‘projectdetails_image’,1,$carousel); if ( !$myimg ) { // use this if you want to show a default image when no image is available in the post $myimg = get_template_directory_uri().’/images/default_banner.jpg’; } if ( $myimg ) { echo “<div class=”item”.( $counter … Read more

Display wordpress post to static website in the footer

EDIT After a brief chat with Original Poster, the following solution works: Install the Magpie RSS library. Create a folder in the root directory of raminusa.com, name it magpierss Upload 4 files (*rss_fetch.inc*, *rss_parser.inc*, *rss_cache.inc*, and *rss_utils.inc*), and the directory extlib to this new folder In the footer script of raminusa.com (which should be in … Read more

Amending PHP for WordPress Theme

You probably want to amend this line: $wp_query->query(‘post_type=product&paged=’.$paged); To include some more limitations, like &department=Featured. I’m unaware of your whole project’s code structure, so I can’t advise exactly what you’d need to put.

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

Password form redirection to belonging post

Here is all you need to make this work, plus your actual form of course: function dopasswordstuff(){ if(isset($_POST[‘homepagepassword’])){ global $wpdb; $post_password = trim($_POST[‘passwordfield’]); $post_id = $wpdb->get_var( $wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE post_password = %s”, $post_password) ); if (!empty($post_id)) { wp_redirect(get_permalink($post_id)); } exit; } } add_action(‘template_redirect’,’dopasswordstuff’); I simplified your function considerably by leveraging the fact that … Read more