mhawksey / wp-evidence-hub

OER Research Hub - WordPress plugin
6 stars 1 forks source link

Option - change 'hypothesis' to 'proposition' throughout [LACE] #39

Closed nfreear closed 9 years ago

nfreear commented 9 years ago

Add an option to use the term "Proposition", in place of "Hypothesis" in both URLs and text (headings etc.)

private function do_rewrites():

add_rewrite_rule("^hypothesis/([0-9]+)/([^/]+)/?",'index.php?post_type=hypothesis&p=$matches[1]','top');
mhawksey commented 9 years ago

I think possible. I'd be reluctant to allow the post_type name to be an option as it's baked in at a number of points and would be a big rewrite. May cause confusion on the API as for some of the calls to fetch 'proposition' you'd set the type as 'hypothesis'.

nfreear commented 9 years ago

Definitely not in the underlying post_type name or other API/ internal workings. I'm just referring to visible stuff like URLs, and any "hardcoded" text.

For example, private function do_rewrites():

-   add_rewrite_rule("^hypothesis/([0-9]+)/([^/]+)/?",'index.php?post_type=hypothesis&p=$matches[1]','top');
+   add_rewrite_rule("^(hypothesis|proposition)/([0-9]+)/([^/]+)/?", 'index.php?post_type=hypothesis&p=$matches[2]', 'top');
mhawksey commented 9 years ago

What about adding as an option in Evidence_Hub (sorry don't have your mastery of git https://github.com/mhawksey/wp-evidence-hub/blob/prop/wp_evidence_hub.php)

nfreear commented 9 years ago

Hi Martin,

Yes, that's pretty much what I have for the text - in the main commit (https://github.com/IET-OU/wp-evidence-hub/commit/330575ad881535d91261c86ea65909e0e5b65a3a), I have:

class Hypothesis_Template extends Evidence_Hub_CustomPostType { 

//...

    public function __construct() {
        parent::__construct();

        $this->is_proposition = $this->get_option( 'wp_evidence_hub_is_proposition' );

        if ($this->is_proposition) {
            $this->archive_slug = "proposition";
            $this->singular = __("Proposition", self::LOC_DOMAIN);
            $this->plural = __("Propositions", self::LOC_DOMAIN);
        }
    }

//...
}

I think the code-changes for this are complete. Progress:

nfreear commented 9 years ago

Regarding your reference to mastery of git (not really!), are you referring to the Markdown syntax used in the issue tracker etc.?

If so, try the original previewer, and GitHub flavoured Markdown

Nick

mhawksey commented 9 years ago

So could be

private function do_rewrites(){
            // adding hypothesis slug option [Bug: #39]
            $hyp_slug = Hypothesis_Template::$archive_slug;