Example #1
0
    function weaver_st_pick_theme($altID)
    {
        // display a picker for the list of themes.
        global $weaver_theme_list;
        // the master list
        $themeimgs = get_template_directory_uri() . '/subthemes/';
        /* define control items for theme picker */
        $curTheme = weaver_getopt('ttw_subtheme');
        $showImg = 'custom.jpg';
        $selectID = 'ttw_subtheme' . $altID;
        // allows more than one form on the same admin page
        $subName = 'setsubtheme' . $altID;
        ?>

    <form name="weaver_select_theme_form" method="post">  <table class="optiontable">
     <tr>
	<th style="width:110px;">Select a theme: &nbsp;</th>
	<td>
	<select <?php 
        echo "name='{$selectID}' id='{$selectID}'";
        ?>
 >
        <?php 
        foreach ($weaver_theme_list as $theme) {
            $name = $theme['name'];
            ?>
	    <option<?php 
            if ($curTheme == $name) {
                $showImg = $theme['img'];
                echo ' selected="selected"';
            }
            ?>
><?php 
            echo $name;
            ?>
</option>
	    <?php 
        }
        ?>
 	</select>
	</td>
	<td ><small>Select a predefined sub-theme from the list.</small>
	<?php 
        echo "&nbsp; &nbsp;<small>Current theme: <strong>{$curTheme}</strong></small>";
        ?>
	</td>
	<td valign="middle" align="left" style="width:120px;">
	<?php 
        echo "&nbsp;&nbsp;<img src='" . $themeimgs . $showImg . "' width=67 height=50 />";
        ?>
	</td>
	</tr>

	<tr><td>&nbsp;</td><td><span class='submit' style="padding-right:15px;"><input <?php 
        echo "name='{$subName}'";
        ?>
 type='submit' value='Set to Selected Sub-Theme'/></span></td>
<?php 
        if (!weaver_allow_multisite()) {
            ?>
                <td ><small><strong>Please note:</strong> Changing sub-theme will replace all theme related your current "Main Options" settings.
		<em>Per site options</em> (those marked with a &diams; on
		the Main Options Page are not changed.)
		You can save them first with the "Save in My Saved Theme" button below.</small></td>
                </tr>
		<tr><td>&nbsp;</td>
		<td><span class='submit'><input name='savemytheme' type='submit' value='Save in My Saved Theme'/></span></td>
		<td colspan='2'><small>Save <u>all</u> currently saved options as <strong>My Saved Theme</strong>.
 You will be able to restore these later by selecting <strong>My Saved Theme</strong>. Please note: be sure to click <em>Save Current Settings</em>
 on the Main Options panel first to save any changes you might have made.</td>
		</tr>
<?php 
        } else {
            ?>
                <td><small><strong>Please note:</strong> Changing sub-theme will replace all theme related settings. <em>Per site options</em> (those marked with a &diams; on
		the Main Options Page, as well as most "Advanced Options" are not changed. (Important: Using "My Saved Theme" saves and restores ALL settings. You can also backup all
		current settings from the Save/Restore tab).</small></td>
                </tr>
<?php 
        }
        /* end TTW_MULTISITE */
        ?>
        </table>
	<?php 
        weaver_nonce_field($subName);
        weaver_nonce_field('savemytheme');
        ?>
    </form>
<?php 
    }
function weaver_save_post_fields($post_id)
{
    $default_post_fields = array('ttw_category', 'ttw_tag', 'ttw_onepost', 'ttw_orderby', 'ttw_order', 'ttw_author', 'ttw_posts_per_page', 'ttw_author', 'hide-primary-widget-area', 'hide-secondary-widget-area', 'top-widget-area', 'bottom-widget-area', 'sitewide-top-widget-area', 'sitewide-bottom-widget-area', 'ttw-hide-page-title', 'ttw-hide-site-title', 'ttw-hide-menus', 'ttw-hide-header-image', 'ttw-hide-footer', 'ttw-hide-header', 'ttw_hide_sticky', 'ttw-force-post-full', 'ttw-force-post-excerpt', 'ttw-show-post-avatar', 'ttw-favorite-post', 'ttw_show_extra_areas', 'ttw_hide_sidebars', 'ttw_show_replace_primary', 'ttw_show_replace_secondary', 'ttw-show-featured', 'ttw-hide-featured-header', 'ttw-stay-on-page', 'ttw-hide-on-menu', 'ttw_hide_pp_infotop', 'ttw_hide_pp_infobot', 'ttw_show_replace_alternative', 'ttw_per_post_style', 'hide_visual_editor');
    if (weaver_allow_multisite()) {
        array_push($default_post_fields, 'wvr_raw_html');
    }
    if (function_exists('weaver_plus_plugin')) {
        // add option only if weaver plus installed
        $all_post_fields = array_merge($default_post_fields, weaver_plus_add_per_opts_list());
    } else {
        $all_post_fields = $default_post_fields;
    }
    if (isset($_POST['ttw_post_meta'])) {
        foreach ($all_post_fields as $post_field) {
            if (isset($_POST[$post_field])) {
                $data = stripslashes($_POST[$post_field]);
                if ($post_field == 'ttw_show_extra_areas' || $post_field == 'ttw_show_replace_primary' || $post_field == 'ttw_show_replace_secondary' || $post_field == 'ttw_show_replace_alternative') {
                    $data = strtolower($data);
                    // force to lower case
                }
                if (get_post_meta($post_id, $post_field) == '') {
                    add_post_meta($post_id, $post_field, weaver_filter_textarea($data), true);
                } else {
                    if ($data != get_post_meta($post_id, $post_field, true)) {
                        update_post_meta($post_id, $post_field, weaver_filter_textarea($data));
                    } else {
                        if ($data == '') {
                            delete_post_meta($post_id, $post_field, get_post_meta($post_id, $post_field, true));
                        }
                    }
                }
            } else {
                delete_post_meta($post_id, $post_field, get_post_meta($post_id, $post_field, true));
            }
        }
    }
}
function weaver_adv_page_template()
{
    ?>
		<a name="custompage" id="custompage"></a>
		<label><span style="color:#00f; font-weight:bold; font-size: larger;">Custom Page Template Options</span></label><br />
		Weaver includes several page templates. Some have extra options that are supported on this sub-tab.<br /><br />

		<label><span style="color:#4444CC;"><b>Per Page Widget Areas</b></span></label>
		<?php 
    weaver_help_link('help.html#PPWidgets', __('Help for Per Page Widget Areas', WEAVER_TRANSADMIN));
    ?>
<br/>
		<small>Weaver will create extra widget areas that will be displayed at the top of the content area on a per page basis. Enter
		a list of one or more widget area names separated by commas. Your names should include only letters, numbers, or underscores -
		no spaces or other special characters. The widgets areas will appear on the Appearance->Widgets menus. They can be included
		on individual pages by adding the name "Weaver Options For This Page" box on the Edit Page menu.</small>
		<br />
		<textarea name="<?php 
    weaver_sapi_advanced_name('ttw_perpagewidgets');
    ?>
" rows=1 style="width: 95%"><?php 
    echo weaver_esc_textarea(weaver_getopt('ttw_perpagewidgets'));
    ?>
</textarea>
		<br />
		<small>Note: these extra widget areas are also used by the Weaver Plus Widget Area shortcode.</small><br /><br />

<?php 
    if (weaver_allow_multisite()) {
        ?>
		<label><span style="color:#4444CC;"><b>"Custom Header Page Template" Code and Options</b></span></label><br/>
		<small>This block functions exactly the same as <strong>Site Header Insert Code</strong> when used with pages created with the
		<em>Custom Header (see Adv Opts admin)</em> page template. The template creates pages that use
		only this code to display a header (they don't use the standard site header image).
		Use Per Page Options on main Edit Page menu to control Menu and Site Title visibility, or add code on a per page basis.</small>
		<br />

		<textarea name="<?php 
        weaver_sapi_advanced_name('ttw_custom_header_insert');
        ?>
" rows=2 style="width: 95%"><?php 
        echo weaver_esc_textarea(weaver_getopt('ttw_custom_header_insert'));
        ?>
</textarea>
<?php 
    }
    // end of major section of not allowed on multisite
    ?>
		<!-- ======== -->

		<br /><br /><label><span style="color:#4444CC;"><b>"Blank Page Template" Options</b></span></label><br/>
		<small>The <em>Blank - (see Adv Opts admin)</em> page template will wrap the content of an associated page only
		with the '#wrapper' HTML div surrounding the optional #header and #footer divs, and the #main div for the actual content.
		('&lt;div id="wrapper">&lt;div id="header">header&lt;/div>&lt;div id="main">Content of page&lt;/div>&lt;div id="footer">footer&lt;/div>').
		You will probably want to wrap your content in its own div with styling defined
		by a class added to the &lt;HEAD> Section. Use Per Page Options on main Page edit menu to control Menu, Site Title, and Header Image visibility.</small>

		<br /><br /><label><span style="color:#4444CC;"><b>Other Page Templates</b></span></label><br/>
		<ul style="list-style-type:disc;margin-left:20px;">
		    <li>The <em>2 Col Content</em> template splits content into two columns. You manually set the column
		    split using the standard WP '&lt;--more-->' convention. Columns will split first horizontally, then vertically (you
		    can have more than one &lt;--more--> tag).</li>
		    <li>The <em>Alternative Sidebar</em> templates have a single, fixed width sidebar that uses only the
		    <em>Alternative Widget Area</em>.</li>
		    <li>The <em>One column, no sidebar</em> template produces a single content column with no sidebars.</li>
		    <li>The <em>Pop Up</em> template allows total custom HTML styling with no predefined div's.</li>
		    <li>The <em>Sitemap</em> provides a page with a basic sitemap.</li>
		</ul>
		<!-- ===================================================== -->

<?php 
}