Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   Adding PHP to single comments (http://forum.bytesforall.com/showthread.php?t=20722)

nevermoor Aug 2, 2013 04:37 PM

Adding PHP to single comments
 
Hello,

First, thanks for the new theme. I'm excited to give it a whirl.

The one problem I have is that I have a bit of PHP work I need to do for each comment, like so:

Use PHP to set variables

Print top of comment
Print variable set by PHP
Print body of comment
Print variable set by PHP
Print bottom of comment

I know I can't use PHP directly in the Montezuma options box, but I can't for the life of me figure out where to put it to achieve this.

juggledad Aug 2, 2013 06:25 PM

You will have to add a dynamic sidebar ( should be called a dynamic widget area) where you want to put in the php. Then use a php plugin like exec-php and add your php to a text widget you put in the new widget area you created.

nevermoor Aug 3, 2013 12:15 AM

I'm not quite sure I follow. There isn't any way to create a php file on the server that will just make the comments display the way I want? This seems like a lot of steps (and exec-php is 4.5 years old, so I suspect it isn't perfectly compatible with newer WP installs).

juggledad Aug 3, 2013 02:53 AM

Quote:

isn't any way to create a php file on the server that will just make the comments display the way I want?
could be, give it a try
Quote:

This seems like a lot of steps (and exec-php is 4.5 years old, so I suspect it isn't perfectly compatible with newer WP installs).
it is the way I've added extra php to the virtual templates and I use exec-php all the time. I suspect it hasn't been updated because there is nothing to update, it is just doing an 'eval()' on the code you enter.

nevermoor Aug 3, 2013 02:45 PM

Thanks.

I can feel myself being dense, but I just can't seem to figure out where anything lives. For example, say I wanted to add another option to the comment quicktag buttons (which are pretty, and a good start). I can't figure out where the file is that allows me to expand on the list provided.

Similarly, if I did want to make a non-virtual subtemplate for individual comment displays, I have no idea where that code goes. I'm going to try to work my head around your solution, and I really like a lot of the features and design in this theme. I'm just having trouble digesting it, I guess.

nevermoor Aug 3, 2013 10:18 PM

So I solved my initial problem by adding functions to the whitelist and then defining them outside the theme. Seems to be the cleanest way since it preserves the web-editable virtual subtemplate.

Next up is the quicktags question.


All times are GMT -6. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.