Kodi Anu WordPress Blog Printer-Wochezeka?

Sindikizani CSS

Momwe ndimamaliza positi dzulo pa Media Social ROI, Ndimafuna kutumiza chithunzithunzi chake kwa Dotster CEO Clint Page. Ndikasindikiza pa PDF, tsambalo linali losokoneza!

Palinso anthu ambiri kunja uko omwe amakonda kusindikiza masamba a webusayiti kuti agawane, kuwongolera pambuyo pake, kapena kungolemba ndi zolemba zina. Ndinaganiza kuti ndikufuna kupanga blog yanga kukhala yosavuta. Zinali zophweka kwambiri kuposa momwe ndimaganizira.

Momwe Mungawonetsere Mtundu Wanu Wosindikiza:

Muyenera kumvetsetsa zoyambira za CSS kuti mukwaniritse izi. Gawo lovuta kwambiri ndikugwiritsa ntchito pulogalamu yanu yosakira asakatuli poyesa kuwonetsa, kubisala, ndikusintha zomwe zili kuti muthe kulemba CSS yanu. Ku Safari, muyenera kuloleza zida zogwirizira, dinani kumanja tsamba lanu ndikusankha Yang'anirani Zinthu. Izi zikuwonetsani zomwe zikuphatikizidwa ndi CSS.

Safari ili ndi mwayi wabwino wosonyeza tsamba lanu posindikiza pa webusayiti:

Safari - Sindikizani Onani mu Web Inspector

Momwe Mungapangire Wanu Wopanga Blog Blog Wanu:

Pali njira zingapo zofotokozera makongoletsedwe anu kuti musindikize. Chimodzi ndikungowonjezera gawo patsamba lanu lamakono lomwe limafotokoza mtundu wa "kusindikiza".

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

Njira inanso ndikuwonjezera pepala lamanema pamutu wa mwana wanu womwe umafotokozera zosankha. Umu ndi momwe:

  1. Kwezani zojambulazo pazowonjezera pamutu wanu wotchedwa sindikizani.
  2. Onjezani kutchulidwa kwa fayilo yatsopano mu fayilo yanu ya functions.php fayilo. Mufuna kuonetsetsa kuti fayilo yanu ya print.css yanyamula pambuyo pa pepala lanu la kholo ndi la ana kuti masitayilo atsitsidwe kumapeto. Ndidapanganso zoyambira 100 potsegula izi kuti zizitha pambuyo pulogi Nazi zomwe ndikuwonekera zikuwoneka:

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);

Tsopano mutha kusintha fayilo ya print.css ndikusintha zinthu zonse zomwe mukufuna kubisala kapena kuwonetsedwa mosiyanasiyana. Mwachitsanzo, patsamba langa ndimabisa zonse zoyenda, ma headers, ma bar, ndi footers kuti zokhazokha zomwe ndikufuna kuwonetsa ndizomwe zimasindikizidwa.

My sindikizani fayilo ikuwoneka motere. Onani kuti ndapanganso ma margins, njira yomwe amavomereza asakatuli amakono:

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

Momwe Kuwonera Kosindikiza Kumawonekera

Umu ndi momwe mawonekedwe anga osindikizira amawonekera ngati asindikizidwa kuchokera ku Google Chrome:

Kuwona kwa WordPress

Zolemba Zapamwamba Zosindikiza

Ndikofunika kuzindikira kuti si asakatuli onse omwe amapangidwa ofanana. Mungafune kuyesa msakatuli aliyense kuti muwone momwe tsamba lanu limawonekera. Ena amathandiziranso masamba ena apamwamba kuti awonjezere zomwe zili, kukhazikitsa masamba ndi kukula kwamasamba, komanso zinthu zina zingapo. Magazini ya Smashing ili ndi nkhani mwatsatanetsatane pazosindikiza izi zosankha.

Nazi zina mwatsatanetsatane wamasamba omwe ndidaphatikizira kuti ndiwonjeze kukopera kumanja kumanzere, cholembera tsamba kumanja kumanja, ndi mutu wazolemba kumanzere kumanzere kwa tsamba lililonse:

@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) " Highbridge, 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

Mukuganiza chiyani?

Tsambali likugwiritsa ntchito Akismet kuchepetsa spam. Phunzirani momwe deta yanu ikufotokozera.