I’m assuming I would do something like:
if (custom-styles.css exists) {
load stylesheet;
}
…but, what happens when both stylesheets have a rule for the same element?
Is there some way to force the custom-styles.css file to be more specific?
Thanks in advance for any advice!
-Justin
This video of Joseph Scott’s Writing Secure Plugins talk was a great introduction, but it left some lingering questions.
Most of his talk emphasizes the importance of not trusting external data and escaping values.
But are there other things we need to be aware of? Some plugins I’m developing have no user interface and only provide developers with tools to code into a theme. Others have a user interface in the dashboard for site administrators, but not for anyone else. What security issues do I need to be aware of for these plugins that won’t be doing anything with outside data?
]]>So this is my code for a single field:
<tr valign="top">
<th scope="row">Height (in pixels)</th>
<td><input style="width: 200px;" type="text" name="height" value="' . get_option('height') . '" /></td>
</tr>
Register the settings
register_setting( 'my-settings-group', 'height' );
and implementing it to a variable
$height = get_option('height');
And then I can put wherever I want. But with checkboxes and dropdowns this method doesn’t work. Any ideas of implementing checkboxes in the same level of simplicity?
]]>https://www.onedesigns.com/tutorials/separate-multiple-theme-options-pages-using-tabs/comment-page-1#nogo
I edited this code so that it wasn’t going to be used for a themes menu but for my plugin menu.
// mt_sublevel_page3() displays the page content for the third submenu
// of the custom Pedigree Builder Admin menu
// the code below creates the tabs
function mt_sublevel_page3($current = 'about') {
$tabs = array( 'about' => 'About Us', 'social' => 'Social Media', 'web' => 'Web Design', 'page9' => 'Videos' );
$links = array();
foreach( $tabs as $tab => $name ) :
if ( $tab == $current ) :
$links[] = "<a class='nav-tab nav-tab-active' href='?page=sub-$tab&tab=$tab'>$name</a>";
else :
$links[] = "<a class='nav-tab' href='?page=sub-$tab&tab=$tab'>$name</a>";
endif;
endforeach;
echo '<h2>';
foreach ( $links as $link )
echo $link;
echo '</h2><hr>';
// use the "PEDIGREE ADMIN CSS" style
echo '<link rel="stylesheet" href="/wp-content/plugins/PEDIGREE/admin/css/pedigree_admin.css" type="text/css" />';
if ( $pagenow == 'pedigree_about.php' && $_GET['page'] == 'mt_sublevel_page3' ) :
if ( isset ( $_GET['tab'] ) ) :
$tab = $_GET['tab'];
else:
$tab = 'about';
endif;
switch ( $tab ) :
case 'about' :
mt_sublevel_page3();
break;
case 'social' :
mt_sublevel_page3();
break;
case 'web' :
mt_sublevel_page3();
break;
case 'video' :
mt_sublevel_page9();
break;
endswitch;
endif;
The only problem is that the content for these pages don’t show up right. I’ve edited the case values, the page now and even tried adding includes, but often just broke the page.
Thoughts? Help?
]]>I am trying to write my own plugin which lets the admin to change some options of the website. When I turn on the plugin it works fine – i can reach it through the menu and it does what I want it to do. However, when it is turned on I can not log out from wordpress – it throws the blank page. It keeps working (logged in) until the session expires. The same is when I try to log in (to reach the wp-admin page from another computer or when the session expires and logs out automatically) – blank page as well.
I tried to search for a blank page problem in this forum, also tried to google, but it usually states different issues and I could not find a solution to my problem. Can someone help?
The plug-in is just one file and it looks like this:
<?php
/*
Plugin Name: Nustatymai
Description: AGAISA puslapio nustatymai
Version: 1.0
Author: AGAISA
*/
add_action('admin_menu', 'load_plugin');
add_action( 'admin_init', 'register_mysettings' );
function register_mysettings() {
register_setting( 'myoption-group', 'email_klausimui');
}
function load_plugin() {
add_object_page("Nustatymai", "Nustatymai", 8, __FILE__, "plugin_function");
}
function plugin_function() {
//...
}
function mysql_update_1() {
//...
}
function mysql_update_2() {
//...
}
?>
Thank you.
]]>