Home Forums WordPress Plugins Hide My WP Remove page base and author base

This topic is: resolved
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #416
    indalab
    Post count: 17

    In settings, if I set to “Author without base” it requires for me to add a page base, but I really don’t like the idea of having a base for pages. I want to be able to keep it the way I have it without hidemywp, where I was able to use %author%/%postname% in permalinks while still being able to access my pages directly using http://my-site/page and not http://my-site/something-else/page. For example, if I wanted to add a link on my footer to the terms page, then I would need to make the link http://my-site/something-else/terms instead of something nicer like http://my-site/terms

    What can I modify in the HideMyWP class to make this possible?

    • This topic was modified 11 years, 1 month ago by indalab.
    #418
    indalab
    Post count: 17

    By the way, I use a plugin to reserve nice names in which I also use to add pages already created, this way users are not able to create a username with the same page name or pages I might use in the future such as: ‘settings’, ‘profile’, ‘support’, ect…

    #419
    indalab
    Post count: 17

    I tried different methods and wasn’t able to. Having author and page in blank will work but not the same as having ‘Author without base’ checked. The reason I say this is because I’m using a infinite scroll inside author page, and with ‘Author without base’ checked I can then scroll to other pages inside the author page. But without it, I can still visit http://mysite/AUTHOR-USERNAME (using %author%/%postname%) but it won’t retrieve the posts. Now if I visit http://mysite/author/AUTHOR-USERNAME then it work.

    I tried functions such as:

    
    function new_author_base() {
        global $wp_rewrite;
        $wp_rewrite->author_base = '';
        $wp_rewrite->author_structure = '/%author%';
       // $wp_rewrite->page_structure  = '';
        //$wp_rewrite->page_structure  = '/%pagename%';
    }
    add_action('init', 'new_author_base');
    
    

    But then other Pages created does not work, only the author page, home, posts, ect…

    It’s probably better using a page base after all…

    • This reply was modified 11 years, 1 month ago by indalab.
    #432
    Hassan
    Post count: 955

    Sorry for long delay,

    First you should know this is one of critical features of HMWP. Current feature is result of hundreds of trials and errors (really!). So I don’t recommend to hack author_structure any more even if you think it works correctly for you!

    I’m not sure I know what you really want but it may work:

    1. Enter /%author%/%post_id%/ or /%author%/%postname%/ as Post Permalink
    2. In a standard WP theme you should now have a working domain.com/username
    3. You can edit author.php file in your theme base on your needs (If you haven’t it copy archive.php and rename it to author.php)
    4. If you want to hide /author/username URLs try changing author base to something else in HMWP and then use Replace in HTML to remove /new_authorbase from source code so the result will be a fancy working author URLs.

    #434
    indalab
    Post count: 17

    Yes, that was the first thing I tried and seems to work, you are able to go to the author page (eg. my-site/username), customize it, ect…, but for some reason it doesn’t allow for me to get more posts, pagination from the author. And this is where I find that my-site/author-username/ and my-site/author/author-username/ is different. If not using the HMWP plugin then my-site/author/author-username/ will work with pagination, but then I notice my-site/author-username/ does not work with pagination. If I was to activate the HMWP plugin and enable the setting to remove author base,”Author without base”, then everything works fine and able to get pagination with only my-site/author-username/. I know it sounds confusing, but having just /%author%/%postname%/ using HMWP does not work, I need to enable the ”Author without base” so that it can work. I even tried replace HTML to remove new_authorbase but that doesn’t seem to work when getting new posts, the pagination does not work. For example, my-site/author-username/page/2. But if I check on “Author without base” on the plugin then everything works.The only thing is that I need to add a Page Base if I was to use “Author without base”. I like the way it’s being used with the setting enabled “Author without base”, i just need to start using a short page base such as my-site/p/termspage (I mean, Youtube uses a page base ” yt “, so I guess it’s not that bad to use) but if there’s a way to get both working (pages and author) without a base, it will be great to know how.

    • This reply was modified 11 years, 1 month ago by indalab.
    • This reply was modified 11 years, 1 month ago by indalab.
    #443
    Hassan
    Post count: 955

    Yes, I agree that working both is great but I spend lots of time to do it results disappoint 😐

    So I think the best way is using a short base (or if post permalink is /%post_name% and it’s working you may consider creating some posts and link them as page!)

    #457
    indalab
    Post count: 17

    Thanks, I figured it out.

    I used this:
    add_rewrite_rule("([^/]+)/?",'index.php?pagename=$matches[1]', 'top');

    Now I can access any page via the page base or without the page base, and also able to use the ‘author without the base’ on your plugin with pagination working.

    #464
    Hassan
    Post count: 955

    Congratulation 🙂

    Smart idea! I don’t even think it could work.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.