Ndi WordPress Blog Printer-Enyi na Enyi?

Bipụta CSS

Ka m dechara ụnyaahụ post na Social Media ROI, Achọrọ m izipu preview nke ya na Dotster CEO Clint Page. Mgbe m bipụtara na PDF, ọ bụ ezie na peeji ahụ bụ ọgba aghara!

A ka nwere ọtụtụ ndị na-anọ ebe ahụ na-achọ ibipụta akwụkwọ nke weebụsaịtị iji kesaa, zoo mgbe e mesịrị, ma ọ bụ naanị tinye ụfọdụ ederede. Ekpebiri m na m chọrọ ịme blọgụ m-enyi na enyi. Ọ dị mfe karịa ka m chere na ọ ga-adị.

Esi gosipụta mbipụta gị:

Ga-achọ ịghọta isi ihe CSS iji mezuo nke a. Akụkụ kachasị sie ike bụ iji njikwa ihe nchọgharị gị iji nwalee igosipụta, zoo, na ịhazigharị ọdịnaya ahụ ka ị nwee ike ide CSS gị. Na Safari, ị ga - enyere ndị ọrụ mmepe aka, pịa aka nri na peeji gị wee họrọ Inyocha Ọdịnaya. Nke ahụ ga-egosi gị mmewere na CSS metụtara.

Safari nwere ntakịrị nhọrọ dị mma iji gosipụta mbipụta nke ibe gị na onye nyocha weebụ:

Safari - Bipute Echiche na Onye nyocha Web

Otu esi eme ka WordPress Blog Printer-Friendly:

E nwere di na nwunye ụzọ dị iche iche nke ịkọwapụta gị styling maka ebipụta. Otu bụ naanị ịgbakwunye ngalaba na mpempe akwụkwọ nke ugbu a bụ nke akọwapụtara na ụdị mgbasa ozi nke "mbipụta".

@media print {
     header, 
     nav, 
     aside { 
         display: none; 
     }
     #primary { 
         width: 100% !important 
     }
     .hidden-print, 
     .google-auto-placed, 
     .widget_eu_cookie_law_widget { 
         display: none; 
     }
}

Otherzọ ọzọ bụ ịgbakwunye otu ụdị mpempe akwụkwọ na isiokwu nwa gị nke gosipụtara nhọrọ mbipụta. Nke a bụ otu:

  1. Bulite mpempe akwụkwọ ndị ọzọ na ndekọ aha isiokwu gị akpọrọ ebipụta.
  2. Tinye ntughari aka na akwukwo ohuru n'ime gi functions.php faịlụ. Ga - achọ ijide n’aka na ebuputara faịlụ gị mgbe nne na nna gị na ụmụ gị ka ha nwee ụdị nke ikpeazụ. Etinyekwara m ihe kacha mkpa nke 100 na ntinye a ka ọ buru ibu mgbe ngwa mgbakwunye Lee ihe ntinye m dị ka:

function theme_enqueue_styles() {
    global $wp_version;
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
    wp_enqueue_style( 'child-style-print', get_stylesheet_directory_uri() . '/print.css', array(), $wp_version, 'print' );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' , 100);

Ugbu a ị nwere ike hazie faịlụ print.css ma gbanwee ihe niile ịchọrọ ịzo ma ọ bụ gosipụta n'ụzọ dị iche. Dịka ọmụmaatụ, na saịtị m, m na-ezogharị nchọgharị niile, nkụnye eji isi mee, sideba na footers ka ọ bụrụ naanị ọdịnaya m chọrọ igosipụta ka ebipụtara.

My ebipụta faịlụ a dị ka nke a. Rịba ama na agbakwunyere m oke, usoro nke ihe nchọgharị nke oge a nabatara:

header, 
nav, 
aside { 
    display: none; 
}
#primary { 
    width: 100% !important 
}
.hidden-print, 
.google-auto-placed, 
.widget_eu_cookie_law_widget { 
    display: none; 
}

Kedu Ka E Si Bipute Lee

Nke a bụ otu esi elele mbipụta m anya ọ bụrụ na edepụtara ya na Google Chrome:

WordPress Bipute Echiche

Advanced Bipụta Styling

Ọ dị mkpa iburu n'uche na ọ bụghị ihe nchọgharị niile ka ha nhata. Nwere ike ịnwale ihe nchọgharị ọ bụla iji hụ otú ibe gị si ele anya n'ofe ha. Ọbụna ụfọdụ na-akwado ụfọdụ atụmatụ ihu igwe dị elu iji tinye ọdịnaya, setịpụrụ oke na peeji nha, yana ọtụtụ ihe ndị ọzọ. Magazin Smashing nwere nke ukwuu ederede zuru ezu na mbipụta ndị a dị elu nhọrọ.

Nke a bụ ụfọdụ nkọwapụta peeji nke m webatara iji tinye aha nwebisiinka na aka ekpe aka ekpe, peeji peeji na aka nri ala, na aha akwụkwọ na aka ekpe nke ibe ọ bụla:

@page { 
    size: 5.5in 8.5in;
    margin: 0.5in; 
}
@page:right{ 
  @bottom-left {
    margin: 10pt 0 30pt 0;
    border-top: .25pt solid #666;
    content: "©  " attr(data-date) " DK New Media, LLC. All Rights Reserved.";
    font-size: 9pt;
    color: #333;
  }

  @bottom-right { 
    margin: 10pt 0 30pt 0;
    border-top: .25pt solid #666;
    content: counter(page);
    font-size: 9pt;
  }

  @top-right {
    content:  string(doctitle);
    margin: 30pt 0 10pt 0;
    font-size: 9pt;
    color: #333;
  }
}

2 Comments

  1. 1
  2. 2

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.