|
|
|
Dodanie AdSense w WordPressie |
« Zobacz poprzedni temat :: Zobacz następny temat » |
Autor |
Wiadomość
|
Lexy |
Wysłany: 05 Wrz 2008, 13:37 Temat postu: Dodanie AdSense w WordPressie |
|
|
Wszechwiedzący
Dołączył: 02 Maj 2006 Posty: 867
|
Chciałabym dodać boks z reklamami Google AdSense na stronie postawionej na WordPressie. Ma się on wyświetlać dopiero po wejściu do konkretnego wpisu, tuż po "czytaj więcej" tak, aby od razu po kliknięciu na link wyświetlała się reklama.
Domyślam się, że muszę to wstawić gdzieś w pliku wp-includes/post-template.php:
Kod: | function the_content($more_link_text = '(czytaj dalej...)', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
}
function get_the_content($more_link_text = '(czytaj dalej...)', $stripteaser = 0, $more_file = '') {
global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
global $preview;
global $pagenow;
$output = '';
if ( !empty($post->post_password) ) { // if there's a password
if ( stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) { // and it doesn't match the cookie
$output = get_the_password_form();
return $output;
}
}
if ( $more_file != '' )
$file = $more_file;
else
$file = $pagenow; //$_SERVER['PHP_SELF'];
if ( $page > count($pages) ) // if the requested page doesn't exist
$page = count($pages); // give them the highest numbered page that DOES exist
$content = $pages[$page-1];
if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
$content = explode($matches[0], $content, 2);
if ( !empty($matches[1]) && !empty($more_link_text) )
$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
} else {
$content = array($content);
}
if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
$stripteaser = 1;
$teaser = $content[0];
if ( ($more) && ($stripteaser) )
$teaser = '';
$output .= $teaser;
if ( count($content) > 1 ) {
if ( $more ) {
$output .= '<span id="more-'.$id.'"></span>'.$content[1];
} else {
$output = balanceTags($output);
if ( ! empty($more_link_text) )
$output .= ' <a href="'. get_permalink() . "\" class=\"more-link\">$more_link_text</a>"; // #more-$id
}
}
if ( $preview ) // preview fix for javascript bug with foreign languages
$output = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $output);
return $output;
}
|
Pytanie tylko gdzie dokładnie? _________________ SEO blog | Korepetycje | Angielski
|
|
Powrót do góry |
|
|
KCS |
Wysłany: Temat postu: Reklama w KCS |
|
|
|
|
Powrót do góry |
|
|
Lexy |
Wysłany: 05 Wrz 2008, 15:00 Temat postu: |
|
|
Wszechwiedzący
Dołączył: 02 Maj 2006 Posty: 867
|
Jednak szukałam w złym miejscu Podaję rozwiązanie - plik ten sam, linijka od 117 dalej:
Cytat: |
$output .= $teaser;
if ( count($content) > 1 ) {
if ( $more ) {
$output .= '<span id="more-'.$id.'"></span>'.$content[1];
} else {
$output = balanceTags($output);
if ( ! empty($more_link_text) )
$output .= ' <a href="'. get_permalink() . "\" class=\"more-link\">$more_link_text</a>"; // #more-$id
}
|
zmienić na:
Cytat: |
$output .= $teaser;
if ( count($content) > 1 ) {
if ( $more ) {
$adsense = '(tu wpisać kod)';
$output .= '<span id="more-'.$id.'"></span>'.$adsense.$content[1];
} else {
$output = balanceTags($output);
if ( ! empty($more_link_text) )
$output .= ' <a href="'. get_permalink() . "\" class=\"more-link\">$more_link_text</a>"; // #more-$id
}
|
Reklama widoczna jest dopiero po przejściu do konkretnego wpisu. _________________ SEO blog | Korepetycje | Angielski
|
|
Powrót do góry |
|
|
|
|
|
|
Strona 1 z 1 |
|
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach
|
|
|
|