I’m tring to add upotheme opt?ons framework for my custom theme.
I added image upload fields but when I click upload button it doesn’t open image upload foorm. It’s sending the form.
What the reason can be?
Thanks..
https://upthemes.com/upthemes-framework/
]]>cheers
<?php
/*
* Plugin Name: opengraph
* Description: Enabling your site with Open Graph metabox on posts
* Version: 10.1
* Author: user256
*/
define('SSD_NAME', plugin_basename( __FILE__ ));
define('SSD_PLUGIN_URL', plugin_dir_url( __FILE__ ));
define('SSD_PLUGIN_PATH', plugin_dir_path( __FILE__ ));
define('SSD_VERSION', '0.1');
/** register css & js **/
wp_register_style( 'ssd-style', plugins_url( 'css/style.css', __FILE__ ), array(), '20130510', 'all' );
wp_register_script( 'ssd-script', plugins_url( '/js/ssd.js', __FILE__ ), array( 'jquery' ) );
/** end register css & js **/
get_template_part( 'unknownpleasures ');
add_action('admin_menu', 'ssd_settings'); // register admin menu
add_action('admin_init', 'register_form_settings'); // register form
/** register menu page **/
function ssd_settings() {
add_menu_page('Structured Social Settings', 'Structured Social', 'administrator', 'ssd_settings_page', 'ssd_display_settings');
}
/** register form fields **/
function ssd_global_options(){
register_setting('ssd_options_group', 'ssd_global_settings', 'ssd_validate');
}
/** enque css & js **/
wp_enqueue_style( 'ssd-style' );
wp_enqueue_script( 'ssd-script' );
function register_form_settings() { // whitelist options
register_setting( 'ssd_global_options', 'twitterid' );
register_setting( 'ssd_global_options', 'fb_link' );
register_setting( 'ssd_global_options', 'ssd-card' );
}
function ssd_display_settings()
{
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br></div>
<h2>Socially Structured Data</h2>
<div class="dev-banner">
<div class="dev-banner-left">Banner Area Left</div>
<div class="dev-banner-right">Banner Area Right</div>
</div>
<div class="dev-clear"></div>
<form method="post" action="options.php">
<?php settings_fields( 'ssd_global_options' ); ?>
<?php do_settings_fields( 'ssd_global_options' ); ?>
<p><strong>Twitter ID:</strong><br />
<input type="text" name="twitterid" size="45" value="<?php echo get_option('twitterid'); ?>" />
</p>
<p><strong>Facebook Page Links:</strong><br />
<input type="text" name="fb_link" size="45" value="<?php echo get_option('fb_link'); ?>" />
</p>
<select name="ssd-card-type" id="ssd-card-type">
<option value="summary">Select Card Type</option>
<option value="summary" <?php if($card_type=="summary") echo 'selected="selected"';?>>Summary Card</option>
<option value="summary_large_image" <?php if($card_type=="summary_large_image") echo 'selected="selected"';?> >Summary Large Image Card</option>
<option value="photo" <?php if($card_type=="photo") echo 'selected="selected"';?>>Photo Card</option>
<option value="gallery" <?php if($card_type=="gallery") echo 'selected="selected"';?>>Gallery Card</option>
<option value="app" <?php if($card_type=="app") echo 'selected="selected"';?>>App Card</option>
<option value="player" <?php if($card_type=="player") echo 'selected="selected"';?>>Player Card</option>
<option value="product" <?php if($card_type=="product") echo 'selected="selected"';?>>Product Card</option>
</select>
<!--summary card -->
<tr id="summary" ><td colspan="2" class="head"><label>Summary Card Details</label></td></tr>
<tr id="summary" ><td class="dev-left">
<label>Title</label></td>
<td class="dev-right">
<input type="text" name="summary[title]" value="<?php echo $summary['title'];?>" size="50" placeholder="Left blank to use Post title by default." />
</td></tr>
<tr id="summary" ><td class="dev-left">
<label>Description</label></td>
<td class="dev-right">
<textarea name="summary[description]" cols="47" rows="4" placeholder="Left blank to use Post excerpt by default."><?php echo $summary['description'];?></textarea>
</td></tr>
<tr id="summary" ><td class="dev-left">
<label>Image</label></td>
<td class="dev-right">
<input type="text" name="summary[image]" value="<?php echo $summary['image'];?>" size="50" placeholder="No image selected then Post feature image or plugin default image will be used." />
</td></tr>
<?php submit_button(); ?>
</form>
</div>
<?php
}
?>
]]>?[ Moderator note: please wrap code in backticks or use the code button. Do not use blockquote. ]
<?php
/*
* Plugin Name: opengraph
* Description: Enabling your site with Open Graph metabox on posts
* Version: 0.1
* Author: user256
*/
add_action('admin_menu', 'ssd_settings'); // register admin menu
add_action('admin_init', 'ssd_form_options'); // register form
function register_mysettings() { // whitelist options
register_setting( 'ssd_form_options', 'twitterid' );
register_setting( 'ssd_form_options', 'fb_link' );
}
/** register form fields **/
function ssd_form_options(){
register_setting('ssd_options_group', 'ssd_global_settings', 'ssd_validate');
}
/** register menu page **/
function ssd_settings() {
add_menu_page('Structured Social Settings', 'Structured Social', 'administrator', 'ssd_settings_page', 'ssd_display_settings');
}
function ssd_display_settings()
{
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"></div>
<h2>Socially Structured Data</h2>
<form method="post" action="options.php">
<?php settings_fields( 'ssd_options_group' );
do_settings_fields( 'ssd_options_group' ); ?>
<p><strong>Twitter ID:</strong>
<input type="text" name="twitterid" size="45" value="<?php echo get_option('twitterid'); ?>" />
</p>
<p><strong>Facebook Page Links:</strong>
<input type="text" name="fb_link" size="45" value="<?php echo get_option('fb_link'); ?>" />
</p>
<?php submit_button(); ?>
</form>
</div>
<?php
}
?>
]]>I am using thesis wordpress theme so i am using custom functions.php
1: When i add this code
function mytheme_option( $option ) {
$options = get_option( 'mytheme_options' );
if ( isset( $options[$option] ) )
return $options[$option];
else
return false;
}
at the top of my custom functions.php i get a white blank page.. im not sure why, if i change the function to “mytheme_options” from “mytheme_option” it seems to work, well my website doesnt crash at least… is the code at the top definately right or am i making a mistake? It is definately this code that is making it crash but i cant work out why?
2: I notice that i havnt added the id code into this section:
$this->settings['example_text'] = array(
'title' => __( 'Example Text Input' ),
'desc' => __( 'This is a description for the text input.' ),
'std' => 'Default value',
'type' => 'text',
'section' => 'general'
);
should i add this manully like
'id' => 'mytextarea1'
How would i add this into a field in my functions.php file, This is the section i want to add the above text area into:
function top_bar() {
?> <div id="#awesome_top_bar_container">
<div class="awesome_top_bar_in">
} ?>
</div></div>
add_action('thesis_hook_before_html','top_bar');
Any advice would be greatly appreciated! sorry for a Newbie questions but i have been struggling with the settings api for so long..
Thanks again
Alex
<span class="abc">
I can add it without the quotes, and it works, but it doesn’t validate. Any ideas?
]]>