• Hi. Im very new at wordpress yet, but I would like to learn more about its functionalities and options. Also Im trying to create a wp plugin for multimedia (photo’s, mp3 and video). In order to do that I send a $GET variable with the url to determine which album or item is requested. However, I have no idea how to stop wp from diplaying the home page. I assume that there is a hook which gives me the ability to disable futher processing of the main content by wp, however i have no idea which hook that is. So if anyone could help me with any kind of a clue or point me to where to read more about having my own custom pages showing up in wp instead of the usuall wp pages, i would be very grateful.

    thanks in advance,
    Fantast~

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Have you tried exit; to stop the PHP processing?

    Thread Starter Fantast

    (@fantast)

    Hey Otto, thanks for the reply.

    Putting exit in the source code of wp would mean hacking it. Im looking for a way to do this solely through a plugin. Maybe i should rephrase my question also a bit: is it at all possible to show a page in a wp blog without having created it by the usual admin page procedure or hacking into the source code of wp?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    What about putting exit; into your plugin? Exit causes PHP to exit. If you’re in a plugin and you exit, then you exit. WP ceases to run, period. Exiting is final. So, once you create your page’s output… you exit. No?

    No hacking of WP source needed.

    Thread Starter Fantast

    (@fantast)

    I see. But wouldnt that mean that i can no longer use the wordpress template?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Well…. that’s what you’re saying that you want to do, no?

    Let’s try it this way: You tell us what the heck you’re trying to do, and we’ll tell you how to do it. Okay?

    Thread Starter Fantast

    (@fantast)

    Thanks for bearing with me Otto, I will try to be more clear with my question.

    Since I asked the question I have been reading through the wp source code and some plugins. That already gave me a solution to my problem (which i only implemented today), but its far from a decent solution as it requires hacking of the template index page…

    What i mean to do is the following: I have a new menu in the sidebar with three page links: photo’s, mp3 and video. So its basicly a multimedia menu. clicking on a menu-item results in the url request: domain/?mm=1. 1 represents photo’s, as 2 and 3 will represent mp3’s and videos respectively. The plugin will read the get command and generate the code for displaying the albums or the photo’s in the albums.

    At the moment to make sure wp does not read any posts from the database if the GET value mm = 1, 2 or 3, i add a filter for the posts_where hook:
    " AND NOTpost_type= 'post'"
    This however results in the error message “Sorry this post has been deleted”, which as far as i can see i can only remove through hacking the template. Also the code generated in the plugin for displaying the multimedia page is displayed through adding a function call in the template page, and thus once again involves hacking. I hoped there was an another way to tell wp it doesn’t need to generate the content as my plugin already will (but the wp template and menus should stay in place, only replacing the posts by my plugin generated code)

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    So, how exactly are you replacing the post’s content with your own content? If you want your content to be displayed instead of Posts, then you must be inserting your information somewhere so that it will be displayed by The Loop, yes?

    Or is that what you’re actually asking here? How to replace the Posts data with your own data?

    If so, then you already kinda know the answer. You’re adding the where clause to stop the Posts being loaded, but that’s not enough. See, every template (and I’m not kidding when I say “every”) uses The Loop in some fashion. When it has no posts to display, then the have_posts() call fails and the template does something else.

    So if you’re not going to load the posts, then you need to have it load something else. And it must have an author, content, date, etc. Everything a post does. Because you don’t want to “hack” the templates, so you have to be capable of replacing any given template, and *all* templates have The Loop.

    Honestly, it seems to me like you’re taking this a bit too far. Doing it the hard way. If you want a custom Page, just make a Page Template, stick a call to your plugin in it, then add the pagename to your URLs in the links.

    Thread Starter Fantast

    (@fantast)

    Hey Otto, thanks for the info. I will start looking at the way the loop works and how it is handled.

    The reason why i didn’t want the custom page to be stored as a page is that i dont want it to be displayed in the “pages” menu. I need it to have its own multimedia menu from where the albums can be accessed. Also since I only just started with this project for now it won’t have too much options yet and I would like to keep it real simple. That would mean that just uploading the files to the server should be enough to display the multimedia menu and its pages.

    In the future however I will definitely have a look at adding an option to choose whether you like to access the albums from the pages menu or a distinct menu. Also more information storing possibilities will be added, which will mean that i would need more database interaction. For this reason I think it would be wiser to already anticipate on those options and thus the method you suggested (using the posts table for the basic storage needs of the multimedia pages) might be afterall the way to go.

    This brings me to a different question: I see that the posts and pages are stored in the same table, with only one distinction: the post_type column. Now there are two ways i could use this to do what you proposed: store a page under a different post_type than post / page or create a new table with the ID’s of the posts which should be neglected when displaying the normal posts. To me it seems like both would work and I actually consider to use both options at the same time to have the advantages of both methods: speed of the different post_type method and storing extra information of the new table method. My only question (for now) is whether there is something I don’t know which makes it less advisebale to use any of the two methods.

    Thanks in advance~

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

The topic ‘surpassing wp content authentication’ is closed to new replies.