Custom page with queries returns 404

WordPress rewrites standard wordpress urls from /category/post-name/ or whatever your selected permalink type is, into index.php?…. You are adding query vars to a link that is already getting rewritten into index.php?… and thus you are getting a 404. My advice to you would be to use something similar to an already asked question at Custom … Read more

How to select a specific page

From WordPress Codex Get Posts. <?php $the_slug = ‘my_slug’; $args = array( ‘name’ => $the_slug, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘numberposts’ => 1 ); $my_posts = get_posts($args); if( $my_posts ) : echo ‘ID on the first post found ‘ . $my_posts[0]->ID; endif; ?> That way you can get a post or page by its … Read more

All Pages visible on the Frontpage

In Twenty Seventeen you can only add 4 page in front-page section. see image below See Appearance=> Customize => Theme Options Update You can add extra section with filter twentyseventeen_front_page_sections add this code in functions.php function tws_custom_front_sections( $num_sections ) { return 5; //Change this number to change the number of the sections. } add_filter( ‘twentyseventeen_front_page_sections’, … Read more

Attachment pages stealing page slugs

I’ve found a workaround if someone has the same problem: In the database, you can search for the attachment page that’s causing problem, you’ll find it in wp_posts by searching for its post_name (which is the slug you want). Then just rename that post_name (in about-img for example). It isn’t a fix but it will … Read more

Special Character Appearing in my WordPress Pages Content

My guess is that you pasted something from a Windows environment and that’s the CR (carriage return, I think) character. I’d go into the editor and just remove those line breaks. That should fix the problem. Also, you might look into standardizing the content type meta tag. You’ve got <meta charset=”UTF-8″ /> I could be … Read more

check first and last child pages wordpress

You can use get_pages() function to do that: global $post; $current_page_id = $post->ID; //Sort by creation time: $args = array( ‘child_of’ => $current_page_id, ‘sort_order’ => ‘ASC’, ‘sort_column’ => ‘post_date’, ‘hierarchical’ => 1, ‘number’ => 1, ); $first_child = get_pages($args); //moddify args to get the last child: $args[‘sort_order’] = ‘DESC’; $last_child = get_pages($args); //when loopting thrugh … Read more