Hot answers tagged

4

The Why Part If we have a page called technical and try to load: example.tld/technical/99999999999999999999 then the 99999999999999999999 part is treated as a page query variable with the value of 2147483647. The reason is this rewrite rule for pages: according to the handy Monkeyman Rewrite Analyzer by Jan Fabry. This part of the ...


3

Retrieve "type" of query from url: Previous suggestions As noted in the linked answer, there's url_to_postid(). This will just get you the ID of the object at that endpoint. Long story short, this function will only return an ID and then run a new \WP_Query to get the post type object from the DB and finally return the URl – if there is any and _if it is ...


1

You should hook add_rewrite_rule() into init Assuming http://local/rieltplus/ is your homepage, and category/catalog/ is a category archives, this should work: add_action('init', function() { add_rewrite_rule( 'category/catalog/([^/]+)?$', ...


1

If the links are coming from the main content areas, you could create a hook which acts against this "content" output. In your themes functions.php file, you could try something like: add_filter('the_content', 'the_url_filter_function_name', 30); function the_url_filter_function_name($content) { return str_replace('bad-url.com', 'good-url.com', ...


1

Thanks to @Max Yudin this is an answer to my problem: function user_content_replace($content) { $sentences_per_paragraph = 3; // settings $pattern = '~(?<=[.?!…])\s+~'; // some punctuation and trailing space(s) $sentences_array = preg_split($pattern, $content, -1, PREG_SPLIT_NO_EMPTY); // get sentences into array $sentences_count = ...


1

The general implementation of such "pretty" permalinks in WordPress is realm of WP Rewrite. However it is pretty wide topic and low level code is a bit of abomination. I would say these are three most common techniques for it, complexity ascending: Use WordPress native data structures (such as Custom Post Types and/or Taxonomies) and benefit from ...


1

So i found a solution. 'with_front' => bool Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true 'rewrite' => array('slug' => 'uslugi-i-czenyi','with_front' => false), Hope helps somebody


1

Should work 'with_front' => false, 'with_front' => bool Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true function uslugi_init() { $args = array( 'label' => 'Услуги', 'public' => true, 'show_ui' ...


1

You can make a custom template for a custom post type. Generally I use the single.php file and duplicate it. Then I rename it to single-{custom-post-type}.php as per Post Type Templates. In your case the template file should look like this single-uslugi.php. As far as saving the old URLs and fixing things I don't quite understand what you are looking for. ...


1

You can only have one page at example.com so let's say you have an 'about' page: example.com/about In Wordpress Settings > Reading Settings you can select a static page to be the homepage, so example.com would now show the 'about' page. Now, go to Wordpress Settings > Permalinks and select Post name.



Only top voted, non community-wiki answers of a minimum length are eligible