WordPress custom URLs for pagination pages

Check the ‘format’ argument <?php $args = array( ‘base’ => ‘%_%’, ‘format’ => ‘?page=%#%’, ‘total’ => 1, ‘current’ => 0, ‘show_all’ => False, ‘end_size’ => 1, ‘mid_size’ => 2, ‘prev_next’ => True, ‘prev_text’ => __(‘« Previous’), ‘next_text’ => __(‘Next »’), ‘type’ => ‘plain’, ‘add_args’ => False, ‘add_fragment’ => ”, ‘before_page_number’ => ”, ‘after_page_number’ => ” … Read more

WordPress converting ../url to http://../url

If you can access your page at http://example/wordpress/page2, then use the following code to output a link to your page, no matter what your site url is: echo site_url(‘/page2/’); This appends the /page2/ to your website’s url (which is http://example/wordpress/ ), which would be : http://example/wordpress/page2/

WordPress .htaccess – route other URLs to another app

Since your WordPress site is just a one-page site, this is served from the single URL http://example.com/. You then want http://example.com/<something> to be internally rewritten to http://example.com/app/<something>. You can add the following mod_rewrite directives before your existing WordPress directives (ie. WordPress front-controller) in your root .htaccess file: # Route all URL-paths (of 1 or more … Read more

Add a URL prefix to permalinks of News category and sub-categories of posts only

add_action( ‘init’, ‘wpa_category_base’ ); function wpa_category_base() { // Remember to flush the rules once manually after you added this code! add_rewrite_rule( // The regex to match the incoming URL ‘news/([^/]+)/([^/]+)/([^/]+)(/[0-9]+)?/?$’, // The resulting internal URL ‘index.php?category_name=$matches[1]/$matches[2]&name=$matches[3]&paged=$matches[4]’, // Add the rule to the top of the rewrite list ‘top’ ); } Custom permalink structure: /media/%category%/%postname%/ Category … Read more