- This topic is empty.
-
AuthorPosts
-
February 7, 2009 at 2:21 pm #24128
Camtech
MemberI have a wordpress 2.7 site on which I am trying to create a small sort of About Us sentence in the footer (much like Chris’s About the Author in the footer of CSS-Tricks). Now this itself is not hard at all, but I would like to be able to edit what this About Us thing says from within the wordpress backend. My initial reaction was to make a plugin, which I have nearly got working.. but the plugin is not my question yet. I am wondering if anyone has a better idea on how to go about doing this. If a plugin is the best way to go then I’ll post what I’ve done so far, it just seems that there might be an easier way to do this.
February 7, 2009 at 2:49 pm #54174ikthius
Memberfrom within wordpress, I think it would have to be a plugin,
I can’t see anything in wordpress that will work with the footer from within wordpress, as in the back end.
why would you not want to change the footer file and upload? why would you want to change the footer so often that you need wordpress?
February 7, 2009 at 3:10 pm #54175Camtech
MemberWell, if it was for me, I would just change the file and upload. And actually the editable footer isn’t extremely important as it won’t be changed too often. But, there is a similar sentence in the header which will be changed more often. I was hoping to end up using the same technique/plugin on that too since its basically the same thing.
February 7, 2009 at 11:05 pm #54179Camtech
MemberI’ve attached what I’ve done so far on the plugin. It works quite well besides that when you Save Changes on the admin page it forwards to the blank options.php with only the footer displayed. I’m sure there is a fix for that, but being my first plugin I’m guessing I just did something wrong.
I was thinking about plugin vs function.php
With the plugin, it can be distributed.. because who knows, people might want this sort of functionality in their other pre-downloaded theme.
But with functions.php it would be theme specific.. which is also okay. But not everyone with a certain theme will need this functionality.But for now, I’ll use whatever works. Don’t exactly have to decide on plugin vs functions until later. After it works and if other people actually want it.
February 8, 2009 at 4:05 pm #54218Chris Coyier
KeymasterI just tested it out and it’s a little funky, but it works! Activating it did bring me to that blank page. When I save the text, it also brings up a nasty warning on an otherwise white page:
Quote:Warning: Cannot modify header information – headers already sent by (output started at /nfs/c02/h02/mnt/21410/domains/jeffcampana.com/html/wp-content/plugins/editable-template-tags/editable-template-tags.php:11) in /nfs/c02/h02/mnt/21410/domains/jeffcampana.com/html/wp-includes/pluggable.php on line 850But… press the back button in the browser and the text DOES save. I’ve used it to control the text in the footer on a new site I built for a friend:
http://jeffcampana.com/February 8, 2009 at 5:50 pm #54220chazzwick
MemberIts quite a long code, but this is what i used to do the same thing for a website recently. The Client wanted a way to put news and traffic updates on their site, and have them update it in wordpress.
Add this code to functions.php:
Code:‘The News!’,
‘theTraffic’ => ‘The Traffic!’,
);var $options;
/* Create new control panel function and defines administration menu, and head you do not need to modify anything in this part */
function ControlPanel() {
add_action(‘admin_menu’, array(&$this, ‘add_menu’));
add_action(‘admin_head’, array(&$this, ‘admin_head’));/* The following code simply add options. and note the word ‘mytheme’ this can be changed to your theme name actually you just need to make all of them look same. */
if (!is_array(get_option(‘mytheme’)))
add_option(‘mytheme’, $this->default_settings);
$this->options = get_option(‘mytheme’);
}/* This adds administration menu: Under Design, it adds a theme page called Simple Control Panel and also notice how I didn’t change mytheme name */
function add_menu() {
add_theme_page(‘Control Panel’, ‘Control Panel’, 8, “mytheme”, array(&$this, ‘optionsmenu’));
}/* Here you put your form CSS. The control panel form has a class of themeform. so Just create your stylesheet here for themeform fields, inputs, etc…I will leave this part for you as its really easy */
function admin_head() {}function optionsmenu() {
if ($_POST[‘ss_action’] == ‘save’) {
/* This is just to update the boxes every time we update the form */$this->options[“theNews”] = $_POST[‘cp_theNews’];
$this->options[“theTraffic”] = $_POST[‘cp_theTraffic’];update_option(‘mytheme’, $this->options); /* Tells wordpress to update your options.. */
echo ‘
Your changes have been saved.
‘; /* Displays successful message.. like changes have been saved! */
}/* That is all.. lets print the form to browser */
echo ‘‘;
}
} /* Quit Control Panel Class. Very important! */
?>
Replace theNews and theTraffic whereever you see them (in your case footersentence and headersentence).
When you logon to wordpress, you should see a menu called "Control Panel" in the Appearance section. In it will be two text boxes which you can put whatever you want in.
Now, add the following to any wordpress page (index.php, footer.php etc)
Code:i think this should work
February 8, 2009 at 9:18 pm #54225Camtech
MemberYeah, I wouldn’t recommend using my plugin quite yet, it also seems to prevent posting and navigating around some parts of the backend… I obviously did something wrong somewhere. For now I’ll try out what chazzwick has posted and see what I can do with that.
Edit: It works quite well. Maybe I’ll attempt to convert it to a plugin if chazzwick doesn’t mind. Key word there is "attempt".
February 9, 2009 at 11:02 am #54137chazzwick
Memberits not my code, this is where i got it from http://www.webloglines.com/blog/stuff/article/building_a_control_panel_for_your_wordpress_theme.php
Youd have to ask them
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.