Помогите с CSS в WP

G
На сайте с 13.05.2013
Offline
1
236

Добрый день форумчане!

Помогите с CSS.

Плагин вывода содержания в посте из заголовков Н2, Н3.

При выводе содержания в начале поста, оно съезжает (залезает на картинку, если задана МИНИАТЮРА в посте)

Плагин под WP, судя по всему рукописный...

Содержание выводится через li, соответственно.

Как переназначить li, а то в середине поста все списки тоже съезжают?

- Первое - сам плагин

- Второй - файл reset.css в котором сбрасываются параметры li,

- и default.css где задается собственно отступ.

Помогите кодом...

Не нужно писать ЧИТАЙ МАНУАЛ....

Ведь, блин, поэтому и обращаюсь к спецам.

Заранее спасибо!!!!!!!!!!!!

<?php

/*
Plugin Name: Marafon.Contents
Version: 0.1
*/

define('MK_CONTENTS_DEEPEST_H', 3);
define('MK_CONTENTS_AT_LEAST', 2);

function mk_contents_get_last_ind($id) {
$pos = strrpos($id, '-');
if ($pos === false) {
return false;
}
return intval(substr($id, $pos + 1));
}

function mk_contents_truncate_last_ind($id) {
$pos = strrpos($id, '-');
if ($pos === false) {
return false;
}
return substr($id, 0, $pos);
}

function mk_contents_increment_last_ind($id) {
$t = mk_contents_get_last_ind($id);
if (!$t) {
return false;
}
$id = mk_contents_truncate_last_ind($id);
$id .= '-' . ($t + 1);
return $id;
}

function mk_contents ( $content = '' ) {
if ( is_single() ) {
if (preg_match_all('|<h([0-9]+)([^>]*)>(.*?)</h|ims', $content, $m)) {

$n = sizeof($m[0]);

// Checks for the needed amount of headers.
$cnt = 0;
for ($i = 0; $i < $n; $i++) {
$m[1][$i] = intval($m[1][$i]);
if ($m[1][$i] <= MK_CONTENTS_DEEPEST_H) {
$cnt++;
}
}
if ($cnt < MK_CONTENTS_AT_LEAST) {
return $content;
}

$initial_content = $content; // Saves the initial content of the post. It is returned whenever some error occurs.
$contents = ''; // For li-elements of the final contents.

//print_r($m);

$prev_h = 1;
$id = 'part';
for ($i = 0; $i < $n; $i++) {
$cur_h = $m[1][$i];
if ($cur_h > MK_CONTENTS_DEEPEST_H) {
continue;
}

// Defines the id (part-...).
if ($cur_h > $prev_h) { // deeper level
$id .= '-1';
} elseif ($cur_h == $prev_h) { // the same level
$id = mk_contents_increment_last_ind($id);
} elseif ($cur_h < $prev_h) { // higher level
for ($t = 0; $t < $prev_h - $cur_h; $t++) {
$id = mk_contents_truncate_last_ind($id);
}
$id = mk_contents_increment_last_ind($id);
}
if (!$id) { // some error
return $initial_content;
}

// Adds the link to the contents.
$contents .= '<li class="cont' . $cur_h . '"><a href="#' . $id . '">' . $m[3][$i] . '</a></li>' . "\n";

// Adds the 'id' attribute to the header.
/*$content = str_replace(
$m[0][$i],
'<h' . $m[1][$i] . ' id="' . $id . '"' . $m[2][$i] . '>' . $m[3][$i] . '</h',
$content
);*/


$content = str_replace(
$m[0][$i],
'<p><a name="'. $id . '"></a></p>' . "\n" . $m[0][$i],
$content
);

$prev_h = $cur_h;
}

$content = '<p>Содержание:</p>' . "\n\n"
. '<ul class="contents">' . "\n" . $contents . '</ul>' . "\n\n"
. $content;

}
}
return $content;
}

add_filter('the_content', 'mk_contents', 10);

?>

/* http://meyerweb.com/eric/tools/css/reset/ 

v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

/**

* GENERAL
----------------------------*/

body {
font-family: Arial, Helvetica, Sans-serif;
font-size: 13px;
}

#container:after, #header:after, #main:after, #main-fullwidth:after, #footer:after, .clearfix:after {
content:"\0020"; display:block; height:0; clear:both; visibility:hidden; overflow:hidden;
}

#container, #header, #main, #main-fullwidth, #footer, .clearfix { display:block; }

.clear {clear:both;}

/* Headings */

h1,h2,h3,h4,h5,h6 {
font-weight: normal;
margin-bottom: 16px;
line-height: 1;
}

h1 { font-size: 40px; }

h2 { font-size: 20px;
color: #1e72c1;}

h3 { font-size: 16px;
color: #1e72c1;}

h4 { font-size: 16px; }

h5 { font-size: 14px; }

h6 { font-size: 12px; }

h1 img, h2 img, h3 img, h4 img, h5 img, h6 img { margin:0; }

/* Paragraps */

p { margin:0 0 20px 0;}

/* Tables */

table {
margin-bottom: 20px;
width:100%;
}

th { font-weight: bold; }
thead th { background: #c3d9ff; }
th,td,caption { padding: 4px 10px 4px 5px; }
tr.even td { background: #e5ecf9; }
tfoot { font-style: italic; }
caption { background: #eee; }

/* Lists */

li ul, li ol { margin: 0; }
ul, ol {
margin: 0 20px 20px 0;
padding-left: 200px;
}


ul { list-style-type: disc; }
ol { list-style-type: decimal; }

dl { margin: 0 0 20px 0; }
dl dt { font-weight: bold; }
dd { margin-left: 20px;}

/* Misc */

blockquote {
margin: 20px;
color: #666;
font-style: italic;
}

pre {
margin: 20px 0;
white-space: pre;
}

pre,code,tt {
font: 13px 'andale mono', 'lucida console', monospace;
line-height: 18px;
}

/**
* MNEUS
----------------------------*/

.menus, .menus * {
margin: 0;
padding: 0;
list-style: none;
list-style-type: none;
line-height: 1.0;
}

.menus ul {
position: absolute;
top: -999em;
width: 100%;
}

.menus ul li {
width: 100%;
}

.menus li:hover {
visibility: inherit;
}

.menus li {
float: left;
position: relative;
}

.menus a {
display: block;
position: relative;
}

.menus li:hover ul,
.menus li.sfHover ul {
left: 0;
top: 100%; /* match top ul list item height */
z-index: 99;
}

.menus li:hover li ul,
.menus li.sfHover li ul {
top: -999em;
}

.menus li li:hover ul,
.menus li li.sfHover ul {
left: 100%; /* match ul width */
top: 0;
}

.menus li li:hover li ul,
.menus li li.sfHover li ul {
top: -999em;
}

.menus li li li:hover ul,
.menus li li li.sfHover ul {
left: 100%; /* match ul width */
top: 0;
}


/* Shadows */

.sf-shadow ul {
padding: 0 8px 9px 0;
-moz-border-radius-bottomleft: 17px;
-moz-border-radius-topright: 17px;
-webkit-border-top-right-radius: 17px;
-webkit-border-bottom-left-radius: 17px;
}

.menus .sf-shadow ul.sf-shadow-off {
background: transparent;
}

/**
* Some Default and WP required styles.
-------------------------------------------------------------- */

blockquote {
overflow: hidden;
padding-left: 9px;
font-style: italic;
color: #666;
border-left: 3px solid #CADAE7;
}

img.wp-smiley {
max-height: 12px;
margin: 0;
padding: 0;
border: none;
}

.aligncenter,
div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}

.alignleft {
float: left;
}

.alignright {
float: right;
}

.wp-caption {
background: #eee;
border: 1px solid #ddd;
text-align: center;
padding-top: 4px;
margin: 10px;
/* optional rounded corners for browsers that support it */
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}

.wp-caption img {
margin: 0;
padding: 0;
border: 0 none;
}

.wp-caption p.wp-caption-text {
font-size: 11px;
line-height: 17px;
padding: 0 4px 5px;
margin: 0;
}

.gallery-caption {
}

.sticky {
}

/**
* Add padding to images in the posts
----------------------------*/

.post img.alignleft {
margin: 0 10px 10px 0;
}

.post img.alignright {
margin: 0 0 10px 10px;
}

.post img.aligncenter {
margin-bottom: 10px;
}

/**
* Wp Calendar
----------------------------*/

#wp-calendar {
empty-cells: show;
font-family: Arial, Helvetica, Sans-serif;
margin: 0;
font-weight: normal;
width: 100%;
border-spacing: 1px;
border-collapse: separate;
}

#wp-calendar caption {
padding: 4px 0;
text-transform: uppercase;
margin: 2px 0 2px 0;
text-align: left;
background: none;
}

#wp-calendar th {
font-style: normal;
text-transform: capitalize;
background: none;
}

#wp-calendar td {
font-family: Arial, Helvetica, Sans-serif;
letter-spacing: normal;
padding: 4px 0;
text-align: center;
background: none;
}

.error {
text-align: center;
color: #fff;
font-weight: bold;
background: Red;
padding: 8px;
font-size: 12px;
margin: 0 0 10px 0;
}

.message {
text-align: center;
color: #fff;
font-weight: bold;
background: Green;
padding: 8px;
font-size: 12px;
margin: 0 0 10px 0;
}
Y
На сайте с 26.04.2012
Offline
77
#1

пациента в студию, воспроизводить это и смотреть на результат желания никакого, а интерпретировать ваш поток сознания в осмысленную вводную не очень получается

Не беру и не ищу проекты.
vlad00777
На сайте с 24.12.2009
Offline
119
#2

ycthrice, согласен. Тс никто не будет просто так заморачиваться с этим кодом. Покажите пациента, тогда желающих будет больше.

Верстка. Качественно! Адаптивная, резиновая, с параллаксом и прочими плюшками. В ЛС.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий