Conditional using get_the_ID() not working [closed]
Try – <?php if ((get_the_ID() != 50) && (get_the_ID() != 317)){ ?> It should be AND not OR for this compare.
Try – <?php if ((get_the_ID() != 50) && (get_the_ID() != 317)){ ?> It should be AND not OR for this compare.
WordPress certainly can scale. WordPress.com alone served 14.6 billion pages last month. The key is that they had hundreds of servers so that they can widely distribute the load. Since they have a more tightly controlled platform, which helps them ensure that they don’t have badly written code slowing things down. But in the end, … Read more
This has nothing to do with htaccess and/or rewrites—at least not directly by you. Just go to Settings -> Permalinks in your WordPress Admin. Then, in the Optional section, set Tag base to article. Hit Save Changes, and that’s it.
$_GET is for accessing variables in URL parameters, it’s not related to any detection by itself, something must be adding it to URL. In context of WordPress it might be related to $is_iphone global. If you look at wp-includes/vars.php there is number of global variables like this, which WP fills up with data via user … Read more
<?php $pages = get_pages( array(‘sort_column’ => ‘menu_order’) ); ?> more info
You could treat products like any other post type and query using get_posts(). Limit the number of posts retrieved to 1 and change the orderby parameter to random: $args = array( ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’, ‘post_type’ => ‘product’ ); $random_products = get_posts( $args ); foreach ( $random_products as $post ) : setup_postdata( $post … Read more
Just a wild guess, but does your theme have a twentyfourteen_paging_nav function? I bet it does not. And that’s the problem. So turn on debugging. // EDIT: There are also some HTML errors in your rendered page. Duplicate <html> tag, incorrect parameter in <nav class=”navbar navbar-default”” role=”navigation”> (note the double “), …
This is pure PHP. $items = get_post_meta($post->ID, “item-specific-meta”); $item_id = 1; $output=””; foreach ($items as $item) { $output .= ‘<label for=”item-‘.$item_id.'”><input id=”item-‘.$item_id.'”/>’.$item.'</label>’; ++$item_id; }
get_page_by_path() should help you here. Something like this <php $prev_url = isset($_SERVER[‘HTTP_REFERER’]) ? $_SERVER[‘HTTP_REFERER’] : ”; if ( $prev_url ) { $prev_path = str_replace( home_url(), ”, $prev_url ); $page = get_page_by_path( $prev_path ); } That should give you the page object, where you can access it’s ID like so – $page->ID.
If you’re trying to load a script from an external source (as your code suggests), please don’t use that article as a reference. It’s littered with bad code, and the comments on the page state several times that it’s outdated and points you to a new article. Here’s how you register and enqueue a script … Read more