January 5, 2012 at 5:44 pm #1021
I sent a message through the contact form, but I thought the forum might be easier to discuss it. I’m looking to use to use this functionality plug-in I build from you, but I need some help to do some things I’m not familiar with. For example; is there anyway to use a PHP function to over-ride basic html coding that is in the header.php?
I use Artisteer to build my own themes, but everytime I update one I have to go through the header to make all my nessicary edits (such as making the logo clickable). How can I abuse this functionality plugin to do it for me?January 6, 2012 at 7:05 am #1022
Hey there, I replied to you yesterday via email, but I’ll do it here too! It’s not actually very easy from what I’ve found. There are php functions available like preg_replace and str_replace, but in my research it seems those are for grabbing strings, and other items which are filterable. I haven’t been able to figure out how to grab raw html yet through php.
The next thing I thought of was jQuery. This looks kind of promising, but it’s absolutely not my strength. I tried for a few hours yesterday…. I’ve been able to swap out content that’s inside a div, or replace an entire div with different content… but not been able to rename the div with the extra info. I’m gonna keep pecking at that, as I’m learning a fair bit as I go. You can try looking up jQuery replace too if you want to give it a go.
My final, and maybe the simplest idea is a child theme. When you update your artisteer theme, how often do you modify the header.php file? http://vudu.me/child if you aren’t familiar with child themes. But basically if you made a very basic child theme, it could just include the required style.css which would simply call back to your themes style.css. The way a child theme works is when activated, if a file exists in it, that file is used, if not, the one from the parent theme is used. So if you ONLY put header.php in the child theme (along with style.css), the header.php from the child theme would be used, but the rest of the files from your artisteer theme would be used. Then, when the artisteer theme is updated, your child theme stays untouched, thus, your header.php file stays untouched.
So if the child theme doesn’t seem the proper route, the jQuery holds the most promise. The jQuery could exist in your functionality plugin, and hook to wp_head… if we could figure out the jQuery portion.January 6, 2012 at 4:03 pm #1025
I bet women would kill for that preg_replace function! (ha ha)
But no, seriously. My problem with child themes is what I’m trying to make would be something to install on new sites, that would have completley different layouts and css codes. I only need to change the header about once an upload and for the most part I only leave one theme on it; except for my blog. I get so ADD with my theme, I’m already looking for support groups ; )
But replacing content in DIVs might work because I could just slap the old school ‘a href’ tag and the header image since my software pumps out the same locations for each theme. I would just need to tie in the code (or whatever it is) to make it work on seprate themes. I’ll have to look around for that then!
I’m even more clueless when it comes to jQuery but I’m starting to get the hang of PHP already. By “get the hang of” I mean I know what I can edit, and copy+paste but as far as writting my own code; the thought alone makes salvation pour from my dumbfounded mouth!
I’ve already used your code to replace the “No Comments On Pages”, and “PageNavi” plugins as well as saving time from copying the “Insert jQuery The Right Way”, “Threaded Comments”, and “Remove HTML Attributes” functions that Artisteer was lacking. So basically it’s already saved me a ton, but if I can squeeze these three little header.php code edits out of it, it’d shake my world as well as most of the Artisteer community : )January 9, 2012 at 7:50 am #1061
I’m gonna keep poking around. Once I start trying to figure something out…. I tend to keep poking. It really seems like the jQuery thing should work for you. I don’t know what artisteer does, but it seems like it might be missing some WP features. I’ll be honest, it only took me about 6 months from installing WP (and having no coding experience) to writing my own theme. I’m just starting on my fifth theme now. Might be an experiment to try soon. Ultimately, it’s the one true way to get a site looking exactly how you want.January 9, 2012 at 9:03 am #1065
Yeah, I don’t think I’m comfortable enough to write my own theme that comes with enough versatility that Artisteer provides (magazine themes, and hundreds of other options).
It is missing some WP features, but with this plug-in I’m working on it should be a breeze to include. Honestly the best thing about the program is the fact it takes me about 10 mintues to make a professional style theme without touching coding.
I’m learning slowly learning; but for now, I know alot of people surviving off Artisteer that are in desperate need of these features lol. & since you’ve given me the confidence to put it together I figured I should throw it together. Pluse it’s good practice since this is really my first REAL experience with PHP ; )January 9, 2012 at 9:19 am #1066
Sure, if it’s working for you, that’s cool! I wasn’t sure, like I said, I’ve never touched artisteer to know what it provides!January 9, 2012 at 9:32 am #1067
Yeah, I mean eventually I want to get where you are and I’m slowly easing my way there. If I can get this simple plug-in down then it’ll be my next step since this a HUGE one for me (and don’t worry you’ll be most of the credit since I couldn’t of done this without you!)
Do you think you can help me with one more thing though? I’m looking at the .replaceWith() function (http://api.jquery.com/replaceWith/) and that seems to be EXACTLY what I need. I can’t just throw this in the plugin.php though, can I? I would need a .js file?
& I apologize if I’m asking too much from you, but you’re the first person I’ve seen that seemed interested in helping / learning this with me : )January 9, 2012 at 10:09 am #1072
I think it needs to be in the section of your website. So you can put it in a function in your plugin that hooks onto wp_head. It will then get spit out in the head section. You would also need jQuery to be enqueued in your theme if artisteer doesn’t do that on it’s own. This can also happen on wp_head.
http://vudu.me/8i has an example of hooking things to wp_head if you are unfamiliar. Again… I think that is where the code goes, so if so, this would work. If the code goes elsewhere, we would have to figure that out.January 9, 2012 at 1:56 pm #1076
Yeah, I’m already using this plug-in to include jQuery “the right way” although I can’t notice a difference so I don’t know if it’s needed or not (I don’t see in the functions.php).
I’m a little confused to this jQuery code since it looks like regular PHP, but I’ll use Google to help me out since I’ve wasted enough of your timeJanuary 9, 2012 at 2:11 pm #1077
I plan to continue poking away at it. So if I find anything out, I’ll definitely post back in this thread!January 9, 2012 at 3:33 pm #1078
Sounds good. Now that I looked into it, I feel like I got the right code, but I can’t for the life of me figure out how to post it : /
The original DIV looks like:
And the image URL / padding is found within the stylesheet. I’m guessing my code (the first one) should work if I can figure out how to enter it correctly lol
I’m a fast learner, but boy; do I get frustrated easily lolJanuary 9, 2012 at 5:46 pm #1079
Well I’m having a slight problem. The damn thing won’t install and says it’s not a valid plugin but if I FTP it it works fine.January 10, 2012 at 6:49 am #1080
Could you drop all the code into a pastebin http://pastebin.com
Save it, and report the link here so I can peep it?
For some reason, posting code works perfectly in my normal posts, and in comments, but not here on the forums yet.January 12, 2012 at 4:17 pm #1115
Sorry I disapeared – came down with a terrible flu this week (still recovering).
Anyways, I think it’s an ecoding issue with my Notepad++ because when I download your files and copy my code to them I don’t seem to have problems but when I start a new .php file in NP++ it seems to force ecode the file to ACIS instead of UTF-8. I’m going to try to re-install the software and see if it works.
As for the code I posted I seem to have mis-placed what I had written, but I’ll try to rewrite it. I doubt it’s going to work since it’s just replacing a div with (same) div/link.January 13, 2012 at 7:19 am #1118
If you can’t sort out the encoding issue with Notepad++, just create the file with normal notepad (if you are using windows). Create a new document, save it as whatev.php and make sure to select all files in the file type dropdown. Then edit it with Notepad++. Always works for me. Hope you are feeling better! I’m really hoping to avoid getting sick this year…
You must be logged in to reply to this topic.