Change "add new topic" link?
-
With the default settings, the “add new topic” link directs to http://yoursite.com/?new=1
How can I change “?new=1” to something more SEO friendly like “add-new-topic”?
-
Also, when I go to add a new topic, how can I change the words “Add New Topic” to something else? I searched through files and couldn’t find anything.
1. I’m wondering what benefit there would be to indexing a page that has no content on it, just the ability to add a new topic?
2. In version 1.0.1 of the software it’s in the template files. You want to find this function:
<?php bb_new_topic_link(); ?>
And make it look like this:
<?php bb_new_topic_link('text Instead of Add New'); ?>
Thanks Chris, but I’m not sure if that answers my question unless I overlooked something.
I’m trying to change the actual link so “?new=1” is instead replaced by “add-new-essay”. So, basically I want the link to be http://mysite.com/add-new-essay
Also, regarding my second problem, I’ve looked in every template file and I can’t find where to change “Add New Topic”. I want to change that to make it say “Add New Essay”.
2. of my reply covers your second problem.
<?php bb_new_topic_link('Add New Essay'); ?>
bb_new_topic_link is called without parameters in your front-page.php template file, but if you pass it the string ‘Add New Essay’ you will see the text in your displayed site change. You are overriding the default text which is in the bbPress core.
The reason you don’t find it in a template file is because it’s not there. The function is there, and is called without parameters. The default text is in the core, but you can override it in your template.
1. I cannot help you with and I questioned the desire to even do something like that. Why would you want an “add new” page indexed when it has no content? What benefit does it give your site?
I imagine you could probably do something to change that using mod_rewrite and your .htaccess file, but I don’t know how to do that.
I’ve searched and there isn’t a <?php bb_new_topic_link(); ?> in my front-page.php.
What version of bbPress are you using? Those instructions are for 1.0.1. Also, are you using a stock theme?
Basically, you need to find, in whatever template file you want to change, the bbPress function that shows that text (it won’t be immediately clear because the function has a default text which is used if you don’t send it anything else. The default text is set in the core file bb-includes/functions.bb-template.php.) Just look in the source of the generated page and try to get some context for where in your template file this function will be (top, middle, bottom, in a table cell, near a unique css id, etc). Then, try adding your text in comments inside the parentheses, instead of them being bare. So, from this:
bb_do_whatever()
to:
bb_do_whatever('Add New Essay')
As we’re here, one might want to browse this thread as well
https://bbpress.org/forums/topic/kin-kakumei-gold-kakumei
There’s a focus on the “look” of the button there, which might well be a good complement…
- You must be logged in to reply to this topic.