Support » Plugins » Starting out, want to add some simple changes

  • So I’m still prepping/testing/refining my WordPress site.
    I’m using ComicPress, but I’m not getting much help on that forum. And since most of the things I want to do are probably related more to WordPress than ComicPress, I might as well ask about them here.

    First of all, one of the things I want to do is add a small piece of text to each page, unique on each page. This is not be confused with the blurb, but is a separate piece of data I want to add with each comic page I post. I want it to actually be placed in the comic pane, but if I can’t figure that out, I can add it to the “beneath the comic” section just as well.

    From what I understand, this is something I want to create as a plug-in, rather than trying to modify the original php code, as this enables me to use updates. And I think I probably just want to create this as a new widget, which lets me add it where I want it on the page.

    So this leads me wonder how I create my own plug-in, how I create my own widget.
    I know how to write HTML and CSS. My experience with PHP is pretty light but I can look up most of what I don’t understand. But even so, this is pretty complex and large system, and I don’t know where to begin with creating something like this, let alone to create something that will properly integrate into an existing system.

    So my first question is if there is any tutorial to explain to me where to begin in creating this widget at all. Beyond that, I wonder how I would go about giving this widget access to unique text for each page it appears on. I don’t know the backend of the system, but if at all possible I would prefer to see a new field I can enter the text into whenever I upload a new post through ComicPress, and whenever I edit a page. But I don’t know if such an option is even possible.

    I also want to make some changes to the theme’s format which cannot be simply altered via CSS, but let’s just start with the basics right now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Okay, I finally found a page of documentation for writing plug-ins, but there’s still a fair amount that I am unsure of.

    The first thing is to find the proper hook to have my text appear where it needs to be. If I have the plug-in automatically add this extra data into the comic pane, then I’d need some hook that puts my additions directly into the comic pane. But this is of course something specific to the ComicPress theme, and so I can’t find it in the regular WordPress hooks.
    But alternatively I could just have this created as a widget, and thus it would be something I could add into any formal section of my page. But I don’t see anything in the documentation that talks about widgets at all. Wouldn’t you create new widgets by adding plug-ins? But I see nothing that details how to do this.

    The next thing I still don’t understand is how to create something that displays specific data according to the date of the post.
    I found a page in the documentation that shows how to use meta functions, which are designed to retrieve/modify specific meta elements within a post. That would be useful, but I would need to create my own new element, I think, and store that into the database somewhere.

    I’m still new here, and I do not see how to do this.

    the format is handled via layout-head.php and layout-foot.php files, if you created a child theme add those to the child themes directory and modify them to the layout you want

    Look in the widgets directory of the theme and mimic it.

    Meta fields are the way you want to go either way with both instances you talk about.

    Look at ComicPress and see how it does the hovertext code and mimic that.

    So here’s where I’m at now:
    First of all, I’ve changed the layout on my site so it doesn’t matter anymore if this text I want to add is in the comic pane or just added as a widget to the “beneath the comic” section. So I’m working on trying to add this as a widget.

    I’ve got a widget created; I’ve been looking at the widgets that come with comicpress and since I don’t need any customized options it is a pretty simple thing. I’ve tested it out as a proof-of-concept, and while it “works,” currently it only adds a static piece of text in the desired format. It does not have any functionality to retrieve any specific text.

    So now I have to get it so that it displays the text I want for each page. Either I’d have to create some new file to store this data, and have it grab it from there, or I have to figure out how to add this new piece of data to the meta. Since I don’t know quite how to do either I’m leaning toward the meta.

    First of all, even the most complex widgets I’ve seen do not have any more than the basic functions in them. So logically the functions they are calling are placed somewhere else. I do not know where this somewhere else is. I would guess it will be in the files I need to add to the plugin directory.

    Next I’m going to have to figure out how to add a new field to the post’s meta. This also includes being able to add the data to that field. I found the files in the Comic Press Manager that build the page I see when I edit a post, and I’m tempted to try to add a new entry field right into that file, but then I won’t be able update comicpress normally.

    I’m looking at the hovertext code so as to mimic that, and for the most part I see functions that do what I need. Displaycomic.php shows how to retrieve the data I need to display. In the Manager I have an example of a field that will receive the data, and I *think* I found where it actually saves this data. But before I can start copying these functions and tweaking them to handle different data, I need to know how I’m supposed to arrange this all within a new plugin. Before I can ask any competent questions about actual problems I am having, I need to know how to build the file I need.

    I’m worried that it is simpler than just creating a new php file and dumping it into the right folder. I mean, how does the system know that it needs to use my new code?

    Nearly every plug-in I take a look at to better understand the format I need to use is in no way formatted, by which i mean there are maybe five line breaks in the entire file so I can’t read it in my text editor. I’d like to think that I’m competent enough to follow some examples so that I can understand how to build this, but dang if it ain’t working out that way.

    (I’d try some experiments but I have to leave now.)

    Erk, dang it, I can’t edit my earlier post, and I just went on too long and didn’t come to the real point I needed to make.

    Okay, so I’ve created a plugin that the system recognizes, even though it baffles me that it can read info that is commented out.

    I set it up to make sure the plugin-itself properly retrieves and displays meta data by having it retrieve and display the hovertext. It is properly working in that regard.

    So what I need now is an ability to actually add my new field of an extra text to the meta. I do not know how to proceed here.

    As I said before, I can see the code used in the ComicPress manager that actually displays an entry field and saves that data to the meta. But I don’t just throw this into my plugin, it has to actually appear somewhere. I don’t even know where I can have this appear.
    I don’t know if it is possible to have a plugin add a new field into the comic press manager’s plugin’s page, let alone how one would do this. And if I have to create a new page just to handle this one input field… where is that page going to go? Where do I access it? And of course, how do I do this?

    So I’ve got everything else working, but I need a way to add data into a new field of my meta.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Starting out, want to add some simple changes’ is closed to new replies.