Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress Custom Fields: Page/Post Spicific Script Includes

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26574
    jaWESome
    Member

    After watching Chris’ screencast on WordPress custom fields (https://css-tricks.com/video-screencasts … wordpress/) I thought about another possible use. Including a script or stylesheet on only one page or post. So I wrote a little script to grab the value of a custom field and output the proper markup to include it in the header. I posted the script and a description of what it does in a post on my website: http://meet.wesleytodd.com/wordpress-sp … ton-fields. I was wondering if someone more knowledgeable could take a look at it and tell me what you think, is this a good way to do this?

    #66187
    TXChetG
    Member

    Have you had the time to read through Chris’ post about his new design on his personal site? http://css-tricks.com/redesigned-personal-site/

    I think he has accomplished with his posts what you are wanting to do. Maybe I’m wrong. This may not be the exact response you were looking for, but I’m hopeful that it helps you.

    #66188
    jaWESome
    Member

    You are right. The plugin he used does almost exactly what I did. I hadnt actually read that whole article yet. I will check out that plugin and thanks for the reccomendation. He is really good at doing things right when I am thinking about how to do it.

    It seems like that plugin has one distinct advantage over my script in that a page that shows multiple posts would load all of the included scripts while you could specify to only load the script in the single view of the post/page if it isnt needed. That is all good and well, but does that extra functionality come at a cost of longer load time? If all you are doing is ocasionally loading a special css or javascript file for a page/post, is the plugin worth it as opposed to this extra 15 lines of code?

    #66190
    TXChetG
    Member

    I don’t know if the increased load time would be terrible noticeable if you’re using optimal coding. I haven’t used the plug-in though, maybe Chris will chime in an offer some thoughtful advice to you. Although his site doesn’t seem to suffer from much of a load time drag.

    Hope everything works out for you in the end.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.