Ndiyo Yako WordPress Blog Printer-Inoshamwaridzika?

Dhinda CSS

Sezvo ini ndakapedza zuro posvo pa Zvemagariro Midhiya ROI, Ini ndaida kutumira preview yacho kuna Dotster CEO Clint Peji. Pandakadhindira kuPDF, zvakadaro, peji racho raive rakashata!

Pachine vanhu vazhinji kunze uko vanofarira kupurinda makopi ewebhusaiti kuti vagovane, mareferenzi gare gare, kana kungo faera nemamwe manotsi. Ndakafunga kuti ndaida kuita yangu blog printa-inoshamwaridzika. Zvaive nyore kupfuura zvandaifunga.

Maitiro Ekuratidza Yako Dhinda Shanduro:

Iwe unozofanirwa kunzwisisa izvo zvekutanga zveCSS kuti uite izvi. Chikamu chakaomesesa kushandisa browser rekuvandudza browser rako kuyedza kuratidza, kuviga, uye kugadzirisa zvirimo kuti ugone kunyora CSS yako. MuSafari, iwe unozofanirwa kugonesa ekuvandudza maturusi, tinya-kurudyi peji rako, uye sarudza Ongorora Zvemukati. Izvo zvinokuratidza icho chinhu uye CSS yakabatana.

Safari ine yakanaka Nice sarudzo yekuratidza iyo yekudhinda vhezheni peji rako muwebhu webhu.

Safari - Dhinda Kutarisa muWebhu Inspector

Maitiro Ekuita Yako WordPress Blog Printer-Shamwari:

Kune nzira mbiri dzakasiyana dzekutsanangura yako dhizaini yekudhinda. Imwe ndeye kungo wedzera chikamu mune rako razvino masheetti rakanangana nerudzi rwe media rwe "kudhinda".

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

Imwe nzira ndeyekuwedzera yakatarwa dhizaini kune yako yemwana theme iyo inotsanangura sarudzo dzekudhinda. Heano maitiro:

  1. Isa imwe yekuwedzera masitaera kune yako theme dhairekitori inonzi purinda.css.
  2. Wedzera chirevo kune iyo nyowani dhizaini mune yako functions.php faira. Iwe uchazoda kuona yako print.css faira rakatakurwa mushure memubereki wako uye mwana masitayipi kuitira kuti iwo masitayera akaremerwa kwekupedzisira. Ini ndakaisawo chekutanga chezana pane iyi kurodha kuitira kuti itakurike mushure mepuregi Hezvino zvandinotarisa zvinoita.

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

Iye zvino unogona kugadzirisa iyo print.css faira uye nekugadzirisa zvese zvinhu izvo zvaunoda zvakavanzwa kana kuratidzwa zvakasiyana. Mune yangu saiti, semuenzaniso, ini ndinovanza zvese kufamba, misoro, mabara epadivi, uye tsoka kuitira kuti chete izvo zvemukati zvandinoshuvira kuratidza ndizvo zvakadhindwa.

My purinda.css faira rinotaridzika seizvi. Cherekedza kuti ini ndakawedzera margins, nzira inogamuchirwa nemabhurawuza azvino:

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

Maitiro Ekudhinda Anotaridzika

Heano maitiro angu ekudhinda anotaridzika kana akadhindwa kubva kuGoogle Chrome:

WordPress Dhinda Kuona

Yepamberi Dhinda Kudyara

Izvo zvakakosha kuti uzive kuti haasi ese mabhurawuza akagadzirwa akaenzana. Iwe ungangoda kuyedza yega yega browser kuti uone kuti peji rako rinotaridzika sei kwavari. Vamwe vanototsigira mamwe epamusoro mapeji maficha ekuwedzera zvemukati, set margins uye saizi saizi, pamwe nezvimwe zvinoverengeka zvezvinhu. Kupwanya Magazini ine yakanyanya yakadzama chinyorwa pane aya epamberi anodhindwa Zvisarudzo.

Heano mamwe marongero epeji peji ini andakabatanidza kuwedzera chirevo chekopirita muzasi kuruboshwe, peji peji pazasi kurudyi, uye zita regwaro kumusoro kwekuruboshwe peji rega rega:

@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

Unofungei?

Nzvimbo iyi inoshandisa Akismet kuderedza spam. Dzidza kuti sei deta yako inoshandiswa.