Category page doesn’t use category.php, instead it redirects to homepage
Check that your category.php file has no errors first. Go to Settings -> Permalinks and save it again to rebuild your permalink structure just in case.
Check that your category.php file has no errors first. Go to Settings -> Permalinks and save it again to rebuild your permalink structure just in case.
Regarding the posts_orderby, posts_where, posts_join and posts_clauses hooks, the current \WP_Query object is available through the second input argument. These are the relevant parts from the \WP_Query class: $orderby = apply_filters_ref_array( ‘posts_orderby’, array( $orderby, &$this ) ); $where = apply_filters_ref_array( ‘posts_where’, array( $where, &$this ) ); $join = apply_filters_ref_array( ‘posts_join’, array( $join, &$this ) ); … Read more
That may be normal behavior, depending on how exactly you’re using is_front_page in your functions file. If you use it inside the global scope of functions.php, it will not work. Why? Because WordPress loads functions.php before the $wp_query object has been set up with the current page. is_front_page is a wrapper around around $wp_query->is_front_page(), and … Read more
One way is to have a single front-page.php and then using get_template_part(), to show different content based on user choice. Rough code: get_header(); $layout = get_option( ‘front_page_layout’, ‘default’ ); get_template_part( ‘front-page’, $layout ); get_footer(); After that you need to create a file for every layout, they should be called, something like: front-page-one.php front-page-two.php front-page-three.php front-page-default.php … Read more
We could implement our own endpoint: https://example.tld/wpse/v1/frontpage Here’s a simple demo (PHP 5.4+): <?php /** * Plugin Name: WPSE – Static Frontpage Rest Endpoint */ namespace WPSE\RestAPI\Frontpage; \add_action( ‘rest_api_init’, function() { \register_rest_route( ‘wpse/v1’, ‘/frontpage/’, [ ‘methods’ => ‘GET’, ‘callback’ => __NAMESPACE__.’\rest_results’ ] ); } ); function rest_results( $request ) { // Get the ID of … Read more
I think this small source code is your solution. It currently doesn’t have frontend feedback for the Sticky Post change, but you can enhance this string, class or whatever you want in the function fb_stick_post. The first function adds the item in the Admin Bar and creates a new Url with a param value. Also, … Read more
Just speculation, but I wonder if you’re running into an anonymous function problem. Anonymous functions are allowed in WP, and usually work fine (presuming updated PHP), but, if you search around you’ll find reports of suspected bugs or at least of unexpected behavior. For that matter, I’m not sure that I’ve ever seen an anonymous … Read more
On the post edit page, if you fill Excerpt box with any text, the_excerpt() function doesn’t add read more link or … at the end of the short description at frontend. Read more link is only included if Excerpt is set empty. This is not a bug, it’s a default behavior. The solution is to … Read more
get_page_by_title() returns an object. Use $homepage->ID. You should also check if you really got a usable return value: $homepage = get_page_by_title( ‘Front Page’ ); if ( $homepage ) { update_option( ‘page_on_front’, $homepage->ID ); update_option( ‘show_on_front’, ‘page’ ); }
I finally got it working, but not with the code in my question. I totally scrapped that whole idea and restarted going in a new direction. NOTE: If anyone is ever able to sort out the issues in my question, feel free to post an answer. Also, if you have any other solutions, feel free … Read more