What is wrong with this? [closed]

The error is in the syntax; there’s a semicolon after the if condition. Try this: <?php $page_comment = get_query_var(‘cpage’); if ($page_comment > 0): ?> test <?php endif; ?> Alternative PHP syntax: <?php $page_comment = get_query_var(‘cpage’); if ($page_comment > 0){ ?> test <?php } ?>

Pagination functions won’t work

Don’t create a new query. You can use pre_get_posts for this type of works. Example : If you want to add books and movies custom post type to home page main loop, function books_movies_cpt_in_home($query) { if ($query->is_home() && $query->is_main_query()) { $query->set(‘post_type’, array(‘books’,’movies’)); } } add_action(‘pre_get_posts’, ‘books_movies_cpt_in_home’);

$paged always 0

function eg_add_rewrite_rules() { global $wp_rewrite; $new_rules = array( ‘(tur|tip|tedarikci|beden|mevsim)/(.+)/?$’ => ‘index.php?post_type=urun&’ . $wp_rewrite->preg_index(1) . ‘=’ . $wp_rewrite->preg_index(2) ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action( ‘generate_rewrite_rules’, ‘eg_add_rewrite_rules’ ); I had this rewrite rule in my functions php. This was overwriting page variable. So i added one more rewrite rule to handle page variable. Here is … Read more

Pagination – linking back to base page – Page 1

<!DOCTYPE html> <html> <head> <style> ul.pagination { display: inline-block; padding: 0; margin: 0; } ul.pagination li {display: inline;} ul.pagination li a { color: black; float: left; padding: 8px 16px; text-decoration: none; transition: background-color .0s; border: 1px solid #aaa; } ul.pagination li a.active { background-color: #f88017; color: white; border: 1px solid #000000; } ul.pagination li a:hover:not(.active) … Read more

Problem with custom WP_Query and underlying pagination/posts_per_page

Stop overriding the default loop and use pre_get_posts instead. Like this: function wpse_247208_custom_category_query( $query ) { // Return early for any situation you aren’t interested in. if ( is_admin() || ! $query->is_main_query() || !is_category() ) { return; } $query->set( ‘posts_per_page’, 6 ); // Don’t use a global; create a function to populate this value // … Read more

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