PHP nested If statement syntax

you can’t run code inside quote since php treats it as string, try this: <?php $newsposts = new WP_Query(‘cat=restaurant’); if ( is_front_page()) { echo ‘<h3 class=”member-review”>Latest Restaurants</h3> <div id=”extra”>’; if ($newsposts->have_posts()) : while ($newsposts->have_posts()) : $newsposts->the_post(); echo ‘<div class=”reslogo”><img src=”‘.catch_that_image().'”/></div>’; endwhile, endif; echo ‘</div>’; } ?>

How to manage multiple wordpress project with shared code base

As mentioned before, never, ever, modify wordpress core files. It is a maintenance nightmare and a security risk, and very, very bad practice. During development the only area you need concern yourself with is the wp-content folder, specifically plugins and themes. Put post type registrations, url rewrites, custom taxonomies etc in a plugin, and visuals … Read more

How to do a code in php and have text before it? [closed]

In order for the server to recognize and execute PHP code, the code must be enclosed within <?php ?> tags. The first argument of the the_title() function is a string that will be output before the page title itself, so <?php the_title(‘Page title: ‘); ?> will print something like Page title: Just Another Post

Code is providing a row of data but not formatting it as table

It’s not displayed as table, because you don’t return correct HTML code. Let’s take a look at your code (I’ve put comments at end of incorrect lines): $content=”<table>”; $content .= ‘</tr><th>Week Beginning</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th><th>Sunday</th><th>Weekly Total</th><th>Previous Week Totals</th></tr>’; // <- here you open TR with </tr>, so it’s already incorrect $results = $seconddb->get_results( ‘ SELECT * FROM seconddb_PontoonBoats_LineOne_2Log’ … Read more

how to edit source code of specific page in wordpress?

Much of the code for any page, including header and footer, comes from your theme. If you want to create fully custom code, your best bet is to create a child theme (which just means creating a “style.css” file with some comments that refer to the parent theme, which is what you’re currently using) and … Read more

How can this crude function be improved?

function admin_trim_category_description( $terms, $taxonomies ){ if( ‘category’ != $taxonomies[0] )return $terms; $whatever_categories = array(‘category1’, ‘hidden’, ‘category2’, ‘category3’); foreach( $terms as $key => $term) if(!in_array($terms[$key]->name, $whatever_categories)) $terms[$key]->description = strip_tags(substr( $term->description, 0, 75 )).”…”; else unset($terms[$key]); return $terms; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)