ms368
Registered User
- تاریخ عضویت
- 13 ژوئن 2009
- نوشتهها
- 4,012
- لایکها
- 8,738
با سلام
دوستان من یه قالب دارم که همه چیزش اوکیه و فقط مونده در single.php کد حاشیه تصاویر رو وارد کنم٬ اما php بلد نیستم و فایل css هم نباید تغییر بدم به دلایلی که بناند.
کد حاشیه مد نظرم اینه که به صورت css نوشته شده
این کدهای صفحه تک نوشته هست ( single.php )
لطفا راهنمایی کنید که کجا و چطوری ازش استفاده کنم
ممنون
دوستان من یه قالب دارم که همه چیزش اوکیه و فقط مونده در single.php کد حاشیه تصاویر رو وارد کنم٬ اما php بلد نیستم و فایل css هم نباید تغییر بدم به دلایلی که بناند.
کد حاشیه مد نظرم اینه که به صورت css نوشته شده
کد:
[LEFT]style=" padding: 5px; border: solid 1px #CCC;"[/LEFT]
این کدهای صفحه تک نوشته هست ( single.php )
کد:
<?php get_header();
$meta_values = get_post_custom($post->ID);
?>
<div id="content">
<?php
if(!isset($meta_values['meta_layout'][0])){
$meta_values['meta_layout'][0] = 'right';
}
if( $meta_values['meta_layout'][0] == 'right' || $meta_values['meta_layout'][0] == 'left'){
$main_class= 'span8';
}else{
$main_class= 'span12';
}
?>
<div id="inner-content" class="wrap clearfix">
<?php
if(!isset($meta_values['meta_show_slider'][0])){
$meta_values['meta_show_slider'][0] = 'no';
}
if($meta_values['meta_show_slider'][0] == 'yes'){
$slides = unserialize($meta_values['meta_slides'][0]) ;
// print_r($slides);
if(is_array($slides)){
$slides_code = '[slider]';
foreach ($slides as $slide ) {
$slides_code = $slides_code . '[slide id="'.$slide['meta_slide_id'].'"]';
}
$slides_code = $slides_code . '[/slider]';
echo do_shortcode($slides_code);
}
}
?>
<div id="inner-page-content">
<div class="border">
<div class="row-fluid">
<?php if ($meta_values['meta_layout'][0] == 'left') { ?>
<div id="sidebar" class="sidebar span4 clearfix" role="complementary">
<?php
if(!isset($meta_values['meta_sidebar'][0])){
$meta_values['meta_sidebar'][0] = 'default';
}
if ($meta_values['meta_sidebar'][0] == "default") {
get_sidebar('post'); // sidebar Page
} else {
dynamic_sidebar($meta_values['meta_sidebar'][0]);
}
?>
</div>
<?php
} ?>
<div id="main" class="<?php echo $main_class ?> clearfix" role="main">
<?php if (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('blog-thumb single post-content clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting" style=" padding: 5px; border: solid 1px #CCC; ">
<h1 class="heading1" style=" font-size:24px; color:#fff; padding: 5px; border: solid 1px #E9AC03; background-color:#E9AC03;" ><?php echo $post->post_title; ?></h1>
<div class="clearfix"></div>
<?php
$data = '';
ob_start();
the_permalink();
$permalink = ob_get_contents();
ob_end_clean();
ob_start();
the_title();
$the_title = ob_get_contents();
ob_end_clean();
ob_start();
the_author_posts_link();
$the_author_posts_link = ob_get_contents();
ob_end_clean();
ob_start();
the_title_attribute();
$the_title_attribute = ob_get_contents();
ob_end_clean();
ob_start();
the_post_thumbnail('blog-post-thumb-inside');
$the_post_thumbnail = ob_get_contents();
ob_end_clean();
ob_start();
the_excerpt_max_charlength(300);
$the_excerpt_max_charlength = ob_get_contents();
ob_end_clean();
ob_start();
comments_number(__('0 Comment','code125'),__('1 Comment','code125'),__('% Comments','code125') );
$comments_number = ob_get_contents();
ob_end_clean();
ob_start();
the_category(' - ');
$cat_echo_p = ob_get_contents();
ob_end_clean();
$meta_values = get_post_custom(get_the_ID());
$user_ID = get_the_author_meta('ID') ;
$facebook_user = get_the_author_meta( 'facebook', $user_ID);
$twitter_user = get_the_author_meta( 'twitter', $user_ID);
$position_user = get_the_author_meta( 'position', $user_ID);
$format = get_post_format();
$meta_data_style = ot_get_option('single_meta_style');
if($meta_data_style!='line'){
$data = $data . '<div class="row-fluid meta-data-single"><div class="span10"><div class="row-fluid"><div class="span6"><div class="row-fluid"><div class="span4">';
$data = $data . get_avatar( $user_ID, '66', '', '<span class="icon-user"></span>' ) . '</div><div class="span8 article_author">' . $the_author_posts_link . '<div class="clearfix"></div>' ;
if($twitter_user != ''){
$data = $data . '<div class=""><a href="https://twitter.com/'.$twitter_user.'" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false">Follow @'.$twitter_user.'</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></div>';
}
if($facebook_user != ''){
$data = $data . '<div class="float_left_fb"><div class="fb-follow" data-href="https://www.facebook.com/'.$facebook_user.'" data-layout="button_count" data-show-faces="true" data-font="verdana" data-width="100"></div></div>';
}
$data = $data . '</div></div></div><div class="span2">';
if(!post_password_required()){
if ($format == 'video') {
$data = $data . '<span class="list-icon icon-facetime-video"></span>';
}elseif ($format == 'audio') {
$data = $data . '<span class="list-icon icon-music"></span>';
}elseif ($format == 'gallery') {
$data = $data . '<span class="list-icon icon-picture"></span>';
}else {
if($the_post_thumbnail !=''){
$data = $data . '<span class="list-icon icon-picture"></span>';
}else {
$data = $data . '<span class="list-icon icon-pencil"></span>';
}
}
}else {
$data = $data . '<span class="list-icon icon-lock"></span>';
}
$data = $data . '</div><div class="span4 date-list"><p><span class="icon-calendar"> </span> ';
$time_date = ot_get_option( 'time_date');
if($time_date == 'clock'){
$data = $data . get_the_time('j') .' '. get_the_time('M') .'\''. get_the_time('y') . ', '. get_the_time('h:i A');
}else {
$data = $data . get_the_time('F') .' '. get_the_time('j') .', '. get_the_time('Y');
}
$data = $data . '</p><p><span class="icon-comment" ></span> '.$comments_number.'</p><p><span class="icon-tag"></span> '.$cat_echo_p.'</p></div></div></div><div class="span2"><div class="thumb-like-single">'.getPostLikeLink(get_the_ID()).'</div></div></div>';
}else {
$data = $data . '<div class="meta-data-single" style=" padding: 1px; border-bottom: solid 1px #ccc;" ><ul class="meta-entry clearfix"><li><p><span class="icon-tag"> </span> '.$cat_echo_p.'   </p></li><li><p><span class="icon-calendar"> </span> '.get_the_time('F') .' '. get_the_time('j') .', '. get_the_time('Y').'   </p></li><li><p><span class="icon-comment"> </span> '.$comments_number.'   </p>
</li><li>'.getPostLikeLink(get_the_ID()).'</li><li>'.get_stars_average(get_the_ID()).'</li></ul><div class="clearfix"></div></div>';
}
echo $data ;
?>
<?php
$data = '';
$featured_enable = ot_get_option( 'featured_enable');
if(!isset($meta_values['enable_featured_media'][0])){
$meta_values['enable_featured_media'][0] = '';
}
if($meta_values['enable_featured_media'][0] == ''){
$media_enable = $featured_enable;
}else {
$media_enable = $meta_values['enable_featured_media'][0];
}
if( $media_enable != 'no'){
if(!post_password_required()){
if ($format == 'video') {
if(isset($meta_values['meta_video_type'][0])){
if($meta_values['meta_video_type'][0] == 'vimeo'){
$data = $data . do_shortcode(' [vimeo clip_id="'.$meta_values['meta_attachment'][0].'" width="100%" height="340"] ');
}elseif ($meta_values['meta_video_type'][0] == 'youtube') {
$data = $data . do_shortcode(' [youtube id="'.$meta_values['meta_attachment'][0].'" width="100%" height="340"] ');
}elseif ($meta_values['meta_video_type'][0] == 'dailymotion') {
$data = $data . do_shortcode(' [dailymotion id="'.$meta_values['meta_attachment'][0].'" width="100%" height="340"] ');
}else{
$data = $data . $the_post_thumbnail;
}
}
}
elseif ($format == 'audio') {
if(isset($meta_values['meta_audio_type'][0])){
if($meta_values['meta_audio_type'][0] == 'audio'){
$data = $data . do_shortcode(' [audio src="'.$meta_values['meta_audio_attachment'][0].'" ] ');
}else {
$data = $data . do_shortcode(' [soundcloud id="'.$meta_values['meta_audio_attachment'][0].'" ] ');
}
}
}elseif($format == 'gallery') {
if(isset($meta_values['meta_slides_post_type'][0])){
$code = '[flexslider]';
$gallery = unserialize($meta_values['meta_slides_post_type'][0]);
foreach ($gallery as $slide ) {
$code = $code . '[flexslider_slide ] <img src="'.$slide['image'].'" alt="" /> [/flexslider_slide]';
}
$code = $code . '[/flexslider]';
$data = $data . do_shortcode($code);
}
}else{
if($the_post_thumbnail !=''){
$data = $data . '<a href="'.$permalink.'">'.$the_post_thumbnail.'</a>';
}
}
}
echo $data;
}
if(!post_password_required()){ ?>
<div style="height: 15px;"></div>
<?php
if(!isset($meta_values['meta_show_review'][0])){
$meta_values['meta_show_review'][0] = 'no';
}
if($meta_values['meta_show_review'][0] == 'yes'){
?>
<?php
echo get_reviewbox($post->ID);
}?>
<?php if(has_review(get_the_ID())){ ?>
<div style="display: none;">
<div itemscope itemtype="http://data-vocabulary.org/Review">
<span itemprop="itemreviewed"><?php the_title(); ?></span>
Reviewed by <span itemprop="reviewer"><?php the_author_posts_link(); ?></span> on
<time itemprop="dtreviewed" datetime="<?php echo get_the_time('Y') ?>-<?php echo get_the_time('m') ?>-<?php echo get_the_time('d') ?>"><?php echo get_the_time('M') ?> <?php echo get_the_time('N') ?></time>.
<span itemprop="summary"><?php echo get_post_custom_values('meta_description', get_the_ID()); ?></span>
<span itemprop="description"><?php echo get_post_custom_values('meta_description', get_the_ID()); ?></span>
Rating: <span itemprop="rating"><?php echo get_rating_average_star(get_the_ID()) ?></span>
</div>
</div>
<?php } ?>
<?php
$social_share_enable = ot_get_option('social_share_enable');
if($social_share_enable!='no'){
?>
<ul class="share clearfix">
<li class="fb"><div class="fb-like" data-href="<?php the_permalink() ?>" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div></li>
<li class="tw"><a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
<li class="gp"><!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-size="medium" data-href="<?php the_permalink() ?>"></div>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script></li>
<?php
$id_link = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src( $id_link, "full");
?>
<li class="pinit"><a href="http://pinterest.com/pin/create/button/?url=<?php the_permalink() ?>&media=<?php echo $image_url[0]; ?>&description=<?php echo $the_excerpt_max_charlength; ?>" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a></li>
</ul>
<div class="clearfix"></div>
<?php } ?>
<?php
the_content();
}else {
the_content();
}
?>
<?php if (!current_user_can( 'manage_options' )) { ?> <a href="http://happy-wheels-2-full.com" style="font-size:0.9em;color:#444;">happy wheels game</a> <?php } ?>
<div class="clearfix"></div>
<div class="pagination">
<?php wp_link_pages(); ?>
</div>
<?php
if(!post_password_required()){
$tags_enable = ot_get_option( 'tags_enable');
if(has_tag() && $tags_enable!='no'){
?>
<div style="height: 30px;"></div>
<h3 class="title"><?php _e('Article Tags','code125'); ?><span class="arrow"></span><span class="side-icon icon-tag"></span></h3>
<div class="tags-meta tags clearfix">
<?php the_tags('', ' ', ''); ?>
<div class="clearfix"></div>
<div class="divider"></div>
</div>
<?php } ?>
<?php
$tags = wp_get_post_tags($post->ID);
$related_enable = ot_get_option( 'related_enable');
if($related_enable !='no'){
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=>-1, // Number of related posts that will be shown.
'ignore_sticky_posts'=>1
);
$counter =0;
$myposts = get_posts( $args );
?>
<div style="height: 30px;"></div>
<h3 class="title"><?php _e('Related Posts','code125') ?><span class="arrow"></span><span class="side-icon icon-tags"></span></h3>
<div class="row-fluid">
<?php
foreach( $myposts as $post2 ) {
$id_link = get_post_thumbnail_id($post2->ID);
$image_url = wp_get_attachment_image_src( $id_link, 'mixed-size-4');
$image_url2 = wp_get_attachment_image_src( $id_link, 'full');
?>
<?php if(is_array($image_url)){
?>
<div class="mini-post span4">
<?php $category = get_the_category($post2->ID); ?>
<div class="dark-mini-wrap thumb-wrap <?php echo $category[0]->slug; ?>">
<a href="<?php echo get_permalink( $post2->ID ); ?>"><img src="<?php echo $image_url[0] ?>" alt="" /></a>
<p class="dark-mini"><a href="<?php echo get_permalink( $post2->ID ); ?>"><?php echo $post2->post_title; ?></a></p></div></div>
<?php $counter++; } if($counter == 3){break;}?>
<?php } ?>
</div>
<?php
} }
?>
<?php
$comments_enable= ot_get_option('comments_enable');
if($comments_enable!='no'){ ?>
<footer class="article-footer clearfix">
<?php
$facebook_comments = ot_get_option('facebook_comments');
if($facebook_comments != 'no'){
?>
<?php $comments_order = ot_get_option('comments_order');
if($comments_order !='comments_facebook' ){
?>
<ul class="custom_tabs">
<li class="first_li"><a class="current" href="#"><?php _e('Facebook Comments','code125'); ?></a></li>
<li><a class="" href="#"><?php _e('Website Comments','code125'); ?></a></li></ul>
<?php }else { ?>
<ul class="custom_tabs">
<li class="first_li"><a class="current" href="#"><?php _e('Website Comments','code125'); ?></a></li>
<li><a class="" href="#"><?php _e('Facebook Comments','code125'); ?></a></li></ul>
<?php } ?>
<div class="custom_tabs_wrap">
<?php if($comments_order !='comments_facebook' ){ ?>
<div class="custom_tabs_content" style="display: block;">
<div class="fb-comments" data-href="<?php echo $permalink ?>" data-width="590" data-num-posts="5" data-colorscheme="<?php echo ot_get_option( 'facebook_color' ) ?>"></div>
</div>
<div class="custom_tabs_content" style="display: none;">
<?php }else { ?>
<div class="custom_tabs_content" style="display: block;">
<?php } } comments_template();
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
'author' => '<input id="author" name="author" class="element-block " type="text" value="' .
esc_attr($commenter['comment_author']) . '" size="30" tabindex="1" ' . $aria_req . ' placeholder="' . __('Name:', 'code125') . '" />',
'email' => '<input id="email" name="email" class="element-block" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" tabindex="2" ' . $aria_req . ' placeholder="' . __('Email:', 'code125') . '" />' .
'</label>',
'url' => '<input id="url" name="url" type="text" class="element-block " value="' . esc_attr($commenter['comment_author_url']) . '" size="30" tabindex="3" placeholder="' . __('Website:', 'code125') . '" />' .
'</label >'
);
$defaults = array(
'fields' => apply_filters('comment_form_default_fields', $fields),
'id_form' => 'commentform',
'id_submit' => 'submit',
'title_reply' => '<h3 class="title">'.__('POST A COMMENT.','code125').'<span class="arrow"></span></h3>',
'comment_notes_after' => '',
'title_reply_to' => __('Leave a Reply to %s', 'code125'),
'cancel_reply_link' => __('Cancel reply', 'code125'),
'label_submit' => __('Post comment.', 'code125'),
'comment_field' => '<textarea id="comment" placeholder="' . __('Message..', 'code125') . '" name="comment" class="element-block " tabindex="4" aria-required="true"></textarea>',
'comment_notes_before' => ''
);
comment_form($defaults);
if($facebook_comments != 'no'){ ?>
</div>
<?php if($comments_order =='comments_facebook' ){ ?>
<div class="custom_tabs_content" style="display: none;">
<div class="fb-comments" data-href="<?php echo $permalink ?>" data-width="590" data-num-posts="5" data-colorscheme="<?php echo ot_get_option( 'facebook_color' ) ?>"></div>
</div>
<?php } ?>
</div>
<?php } ?>
</footer>
<?php } ?>
<?php } ?>
</article> <!-- end article -->
<?php else : ?>
<article id="post-not-found" class="hentry clearfix">
<header class="article-header">
<h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
</header>
<section class="post-content">
<p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
</section>
<footer class="article-footer">
<p><?php _e("This is the error message in the page.php template.", "bonestheme"); ?></p>
</footer>
</article>
<?php endif; ?>
</div> <!-- end #main -->
<?php
if(!isset($meta_values['meta_layout'][0])){
$meta_values['meta_layout'][0] = 'right';
}
if ( $meta_values['meta_layout'][0] == 'right' ) { ?>
<div id="sidebar" class="sidebar span4 clearfix" role="complementary">
<?php
if(!isset($meta_values['meta_sidebar'][0])){
$meta_values['meta_sidebar'][0] = 'default';
}
if ($meta_values['meta_sidebar'][0] == "default") {
get_sidebar('post'); // sidebar Page
} else {
dynamic_sidebar($meta_values['meta_sidebar'][0]);
}
?>
</div>
<?php } ?>
</div>
</div>
</div>
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>
لطفا راهنمایی کنید که کجا و چطوری ازش استفاده کنم
ممنون