Trying to modify content.php

The answer is in your code. It’s even documented: <?php if (is_search()) { // Only display Excerpts for Search ?> <div class=”entry-summary”> <?php the_excerpt(); ?> <div class=”clearfix”></div> </div><!– .entry-summary –> <?php } else { ?> <div class=”entry-content”> <?php the_content(bootstrapBasicMoreLinkText()); ?> <div class=”clearfix”></div> <?php /** * This wp_link_pages option adapt to use bootstrap pagination style. * … Read more

Check if post visited first time

You can try this, use of custom meta field to do that. In functions.php put this: // add the tracker in your header by using wp_footer hook function is_viewed ($post_id) { if ( !is_single() ) return; /* At times queries performed in other templates such as sidebar.php may corrupt certain conditional tags. For instance, in … Read more

Unable to insert current username into custom table through html form

wp_get_current_user returns a WP_User object. You’ll need to pull the name out of that in order to send it try $current_user->display_name in your insert statement. On that note, you should absolutely not be inserting unsanitized user entered data into your database. Please look into SQL injection and input sanitization.

adding or removing endforeach; throws error!

If you pasted your code directly, The second curly bracket here <?php if($k==0) { ?> active <?php { ?> should be a closing one, like this: <?php if($k==0) { ?> active <?php } ?> There is also a stray slash </a>/</li> – should be – </a></li> – but that shouldn’t cause any PHP errors.

Error inserting into custom table – Object of class wpdb could not be converted to string [closed]

$wpdb->$table_name is not a valid table name. Use $table_name $wpdb->query( $wpdb->prepare( ” INSERT INTO $wpdb->$table_name ( first_name, last_name, email,telephone,user_name) VALUES ( %s, %s, %s,%s,%s ) “, $first_name,$last_name,$email,$telephone,$current_username ) ); should be $wpdb->query( $wpdb->prepare( ” INSERT INTO $table_name ( first_name, last_name, email,telephone,user_name) VALUES ( %s, %s, %s,%s,%s ) “, $first_name,$last_name,$email,$telephone,$current_username ) );