php 手动更新到AgentPress v1.0.1并更改Slider
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 手动更新到AgentPress v1.0.1并更改Slider相关的知识,希望对你有一定的参考价值。
/**** Remove following from style.css ******/
/***** Slider ********************/
#gen-slider-wrap {
background: #FFFFFF;
width: 920px;
height: 300px;
margin: 0 auto 0;
padding: 10px;
border: 10px solid #516B86;
}
#gen-slider-wrap p {
margin: 0;
padding: 0 0 5px 0;
}
#gen-slider-wrap h2 {
font-family: Georgia, Times New Roman, Trebuchet MS;
font-size: 18px;
font-weight: normal;
margin: 0;
padding: 0 0 5px 0;
}
#gen-slider-wrap h2 a, #gen-slider-wrap h2 a:visited {
color: #072C53;
text-decoration: none;
}
#gen-slider-wrap h2 a:hover {
color: #5F788E;
text-decoration: none;
}
#controller {
float: left;
display: inline-block;
clear: both;
margin: 0;
padding: 0;
}
#controller span {
background-repeat: no-repeat;
display: inline-block;
padding: 0;
margin: 0;
}
#jFlowSlide {
float: left;
position: absolute;
margin: 0;
padding: 0;
display: inline-block;
clear: both;
z-index: 1;
}
#jFlowSlide img {
margin: 0;
padding: 0;
float: left;
position: absolute;
z-index: 1;
}
#slides {
margin: 0;
padding: 0;
width: 920px;
height: 300px;
float: left;
position: absolute;
z-index: 1;
overflow: hidden;
}
.jFlowSlideContainer {
margin: 0;
padding: 0;
}
.jFlowSlideControl {
margin: 0;
padding: 0;
}
.slideinfo {
float: left;
display: block;
background: none;
width: 400px;
max-height: 460px;
margin: 10px 0 0 490px;
padding: 10px;
position: absolute;
z-index: 8;
}
html > body .slideinfoborder {
float: left;
display: inline;
position: relative;
background: none;
width: 378px;
padding: 10px 10px 5px 10px;
margin: 0;
border: 1px solid #FFFFFF;
z-index: 8;
}
.slideinfoborder /* IE6 Fix */ {
float: left;
display: inline;
position: absolute;
background: none;
width: 378px;
padding: 10px 10px 5px 10px;
margin: 0;
border: 1px solid #FFFFFF;
z-index: 8;
}
html > body .slideinfobg {
float: left;
display: block;
position: absolute;
background: #FFFFFF;
width: 420px;
height: 100%;
margin: -10px 0 0 -10px;
padding: 0px;
filter: alpha(opacity=70); /* CSS3 standard */
opacity: 0.7;
z-index: 6;
}
.slideinfobg /* IE6 Fix */ {
float: left;
display: block;
position: absolute;
background: #FFFFFF;
width: 420px;
height: 460px;
margin: -10px 0 0 -10px;
padding: 0px;
filter: alpha(opacity=70); /* CSS3 standard */
opacity: 0.7;
z-index: 6;
}
#jFlowSlide .slideimage {
margin: 0;
padding: 0;
}
#previous a img {
float: left;
display: block;
background: transparent url(images/slider-previous.png) no-repeat;
margin: 240px 0 0 10px;
width: 48px;
height: 55px;
position: absolute;
clear: both;
z-index: 9;
overflow: hidden;
}
#previous a:hover img {
background-position: -48px 0;
}
#next a img {
float: right;
display: block;
background: transparent url(images/slider-next.png) no-repeat;
margin: 240px 0px 0px 865px;
width: 48px;
height: 55px;
position: absolute;
clear: both;
z-index: 9;
overflow: hidden;
}
#next a:hover img {
background-position: -48px 0;
}
.gen-slider {
float: left;
display: block;
clear: both;
margin: 0;
padding: 0;
position: relative;
z-index: 1;
}
.gen-slider h1 {
margin: 0;
}
<?php
//* Remove the following code from functons.php
// Add the slider on the homepage above the content area
add_action('genesis_after_header', 'agentpress_include_slider');
function agentpress_include_slider() {
if(is_front_page() && genesis_get_option('slider_enable'))
require(CHILD_DIR . '/slider.php');
}
<?php
//* Remove the following code from functons.php
// Add new box to the Genesis -> Theme Settings page
add_action('admin_menu', 'agentpress_add_settings_boxes', 11);
function agentpress_add_settings_boxes() {
global $_genesis_theme_settings_pagehook;
add_meta_box('genesis-theme-settings-slider', __('Slider Settings', 'agentpress'), 'agentpress_theme_settings_slider_box', $_genesis_theme_settings_pagehook, 'column2');
}
function agentpress_theme_settings_slider_box() { ?>
<p><input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[slider_enable]" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[slider_enable]" value="1" <?php checked(1, genesis_get_option('slider_enable')); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[slider_enable]"><?php _e('Enable the Slider?', 'agentpress'); ?></label></p>
<p><label><?php _e('Category', 'agentpress'); ?>: <?php wp_dropdown_categories(array('name' => GENESIS_SETTINGS_FIELD.'[slider_cat]', 'selected' => genesis_get_option('slider_cat'), 'orderby' => 'Name' , 'hierarchical' => 1, 'show_option_all' => __("All Categories", 'agentpress'), 'hide_empty' => '0')); ?></label></p>
<p><label><?php _e('Number of Posts', 'agentpress'); ?>: <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[slider_num]" value="<?php genesis_option('slider_num'); ?>" size="5" /></label></p>
<p><label><?php _e('Time Between Slides (in milliseconds)', 'agentpress'); ?>: <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[slider_timer]" value="<?php genesis_option('slider_timer'); ?>" size="5" /></label></p>
<p><label><?php _e('Slide Transition Speed (in milliseconds)', 'agentpress'); ?>: <input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[slider_duration]" value="<?php genesis_option('slider_duration'); ?>" size="5" /></label></p>
<?php
}
// Add new default values for the slider
add_filter('genesis_theme_settings_defaults', 'agentpress_slider_defaults');
function agentpress_slider_defaults($defaults) {
$defaults['slider_enable'] = 1;
$defaults['slider_num'] = 1;
$defaults['slider_timer'] = 6000;
$defaults['slider_duration'] = 400;
return $defaults;
}
<?php
//* Remove the following code from functons.php
// Load script for jFlow slider
add_action('get_header', 'agentpress_load_scripts');
function agentpress_load_scripts() {
wp_enqueue_script('jflow', CHILD_URL.'/lib/js/jquery.flow.1.1.js', array('jquery'), '1.1', TRUE);
}
// Load parameters for jFlow slider
add_action('wp_footer', 'agentpress_jflow_params');
function agentpress_jflow_params() {
$timer = intval(genesis_get_option('slider_timer'));
$duration = intval(genesis_get_option('slider_duration'));
$output = '
jQuery(document).ready(function($) {
$("div#controller").jFlow({
slides: "#slides",
width: "920px",
height: "300px",
timer: '.$timer.',
duration: '.$duration.'
});
});
';
$output = str_replace(array("\n","\t","\r"), '', $output);
echo '<script type=\'text/javascript\'>'.$output.'</script>';
}
<?php
//* Add the following code to functions.php just below other registered widget areas
genesis_register_sidebar(array(
'name'=>'Slider',
'id' => 'slider',
'description' => 'This is the slider section on the homepage',
));
<?php
//* Add the following code to functons.php - replaces code from remove-3.php
/** Add the slider on the homepage above the content area */
add_action('genesis_after_header', 'agentpress_include_slider');
function agentpress_include_slider() {
if(is_front_page())
dynamic_sidebar( 'slider' );
}
以上是关于php 手动更新到AgentPress v1.0.1并更改Slider的主要内容,如果未能解决你的问题,请参考以下文章
css AgentPress Pro Home Bottom以帖子而非页面为特色