Archived topic
Rewrite URL fragment/anchor
19 replies · Started by Former User on August 24, 2019
The theme generates URI with URL fragments or anchors e.g. http://www.domain.com/post-name/#post-id. There doesn't appear to limit this to only http://www.domain.com/post-name. What options are there to remove the #post-id URL fragment?
Hi there,
This should help:
https://docs.generatepress.com/article/generate_more_jump/
Let me know :)
Thanks Leo. Which file does it need to be added to?
Hi there,
that PHP snippet should go in your child themes function.php
Thanks David. Can you please confirm the path of the child theme?
Not quite sure if I understand.
When you download and install a child theme from here:
https://docs.generatepress.com/article/using-child-theme/#installing-a-child-theme
You get a folder named generatepress_child with 3 tiles in it:
https://www.screencast.com/t/FONtnocsr9
Thanks Leo.
The theme was installed via GenerePress' site library option. There isn't a directory called "generate_child".
Is the directory path for example /home/user/public_html/wp-content?
The site library templates aren't child themes.
You will need to add one using the instruction here first:
https://docs.generatepress.com/article/using-child-theme/#installing-a-child-theme
Or just use the Code Snippets option here:
https://docs.generatepress.com/article/adding-php/
Thanks Leo. Why is there a need to install a child theme?
Can the removal of the URL fragment be achieved without it and the use of a plugin?
You have to choose either a child theme or a plugin to add PHP.
Thanks Leo. Will uploading the child theme overwrite any of the pages, posts and/or settings?
No :)
Hi Leo,
The filter add_filter( 'generate_more_jump', '__return_false' ); was added to the wp-content/themes/generatepress_child/functions.php file. It does not however remove the URL fragment or anchor from the read me button.
The child theme was uploaded following the instructions at https://docs.generatepress.com/article/using-child-theme/. I assume that the child team does not need to be activated.
Hi there,
the Child Theme has to be activated.
Thanks David. The documentation did not include the requirement to activate it.
It works now although it has distorted the "Split" navigation menu. How can it be reinstated?
There was no custom CSS other than the "Additional CSS" which has now been lost.