Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Virtual" slugs?
#6
Zegnåt Wrote:
RobA Wrote:I need to […] put in a plugin hook using some short code like (% whatever %).
No you don’t.
Code:
add_action('index-pretemplate','changeContent');
function changeContent() {
    global $content;
    $content = 'My plugin content!';
}
...

@Zegnåt - so that code and this:

Code:
add_filter('content','changeContent');
function changeContent($contents) {
  $my_content = 'My plugin content!';
  return $my_content;
}

do the exact same thing? Which is preferred then?

@all - Some good suggestions in general! Thanks. It still seems like a lot of steps to do one thing. Look at the simple case of a contact page. To make a contact page you need to:
1) install the contact plugin.
2) configure the plugin.
3) create new contact page, making sure you add it to the menu, and add the correct plugin code to the page.

and the plugin code will be executed for every page (be default) unless the steps suggested were followed.

Even with those suggestions, it seems odd to have to create a page (whose content is always overwritten) in order to work.

I guess I was thinking of a something in the 404 handler to check "nope, not a real (xml) page", then check to see if any plugins have registered to have a certain slug, and call the registered function to generate content using the default page template, to avoid the need to create a page.

-Rob A>
Reply


Messages In This Thread
"Virtual" slugs? - by RobA - 2011-06-17, 00:49:59
"Virtual" slugs? - by mvlcek - 2011-06-17, 01:07:26
"Virtual" slugs? - by ccagle8 - 2011-06-17, 01:18:35
"Virtual" slugs? - by mvlcek - 2011-06-17, 01:25:59
"Virtual" slugs? - by Zegnåt - 2011-06-17, 01:28:27
"Virtual" slugs? - by RobA - 2011-06-17, 03:52:54
"Virtual" slugs? - by Zegnåt - 2011-06-17, 09:24:05



Users browsing this thread: 1 Guest(s)