How do I reformat this to add php inside php?

As PHP documentation says Often you’d want to have more than one statement to be executed conditionally. Of course, there’s no need to wrap each statement with an if clause. Instead, you can group several statements into a statement group. So You have to use curly braces {} to add more statement within if else … Read more

Conditional sidebar menu

Bainternet’s solution will definitely work, but it you want to use the page slug instead of ID you could put this in your functions.php file: // GET PAGE ID FROM THE SLUG, HELPER FUNCTION FOR IS_TREE function get_ID_by_slug($page_slug) { $page = get_page_by_path($page_slug); if ($page) { return $page->ID; } else { return null; } } // … Read more

Create citation and url in post using 3 custom fields with conditions for each field… So close!

I’m not sure if I’m meeting all of your requirements here, but I think this might work. <div class=”source”> <?php $name = get_post_meta($post->ID, ‘sourcename’, true); $url = get_post_meta($post->ID, ‘sourceurl’, true); $title = get_post_meta($post->ID, ‘sourcetitle’, true); $snippet = str_replace( “http://”, “”, $url ); $snippet = substr( $snippet, 0, 22 ) . “…”; if ( !empty( $title … Read more

Template tag for /page/# structure

WordPress provides is_paged() which returns true on any archive or blog that stretches over multiple pages. This isn’t what you want, but the is_paged Codex article tells us where to go: If you need to check which page of the blog you are on, you can look in $wp_query->query_vars[‘paged’]. Remember that inside functions you might … Read more

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