Posted on

wpJakarta Warung Produktif Jakarta, Website Optimasi Bisnis, Blog Dan Komunitas

wpJakarta – WP For Warung Produktif

wpJakarta.Com – WP Jakarta, a Non Open BO Company. Website “native” yang fokus pada pengembangan usaha dan pemasaran secara online dengan platform CMS WordPress + WooCommerce.

Kunjungi juga website “native” jaringan usaha kami freshplus62.com. Ada peluang kerjasama usaha yang kami buka, barangkali kita bisa bermitra yang dapat memberikan keuntungan bersama.

wp jakarta open BO
Continue reading wpJakarta Warung Produktif Jakarta, Website Optimasi Bisnis, Blog Dan Komunitas
Posted on

Tips Trik WordPress –> wpJakarta

Tips Trik WordPress –> wpJakarta. Artikel post berisi kumpulan kode WP dan pemrograman lainnya yang telah dipublish di wpJakarta.Com. Untuk arsip dan referensi wpJakarta sendiri. (Kode yang anda cari mungkin ada disini).


Menonaktifkan XML-RPC WordPress

Referensi Artikel : https://wpjakarta.com/blog/cara-menonaktifkan-xml-rpc-wordpress/

Tambahkan kode berikut pada file .htaccess :

 # Blok WordPress xmlrpc.php
 <Files xmlrpc.php>
 order deny,allow
 deny from all
 allow from xxx.xxx.xxx.xx
 </Files>

Mengganti logo dan link login form WordPress

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/rubah-logo-link-form-login-wordpress/
Pada file function.php di folder themes, masukan seluruh kode berikut, (lihat /* — komen — */ untuk bagian-bagian yang diganti :

 /* ------------------------------------------------------ */
 /* --------------- wpJakarta login custom --------------- */
 /* ------------------------------------------------------ */
 if ( !function_exists( 'wpj_custom_login_style' ) ) {
  function wpj_custom_login_style() {
   //echo 'CSS CODE…';
  }
 }
 
 add_action('login_head', 'wpj_custom_login_style');
 
 /* ----------------------------- Ganti Logo ------------------------------ */
 function wpj_login_logo() { ?>
  <style type="text/css">
  #login h1 a, .login h1 a {
    background-image: url(https://example.com/path/to/file_site_logo.png);
    height: 80px;
    width: 320px;
    background-size: 320px 80px;
    background-repeat: no-repeat;
    border-radius: 5px;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3), 0 6px 20px 0 rgba(0, 0, 0, 0.3);
  }
  </style>
 <?php 
 }
 
 add_action('login_head', 'wpj_login_logo');
 
 /* ----------------------------- Ganti URL ------------------------------ */
 function wpj_login_url() {
   return home_url();
 }
 
 add_filter('login_headerurl', 'wpj_login_url');
 
 function wpj_login_title() {
   return get_option('blogname');
 }
 
 add_filter('login_headertitle', 'wpj_login_title');
 
 /* ------------------ Ganti Background, Form Dan Tombol ------------------ */
 function wpj_custom_login_page() { ?>
  <style type="text/css">
    body.login {
      background-color: #1ABEFD;
      color: #ffffff;
    }
    body.login a {
      color: #ffffff;
    }
    #loginform {
      background-color: #3F17D5;
      border-color:#3F17D5;
      box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3), 0 6px 20px 0 rgba(0, 0, 0, 0.3);
      border-radius: 5px;
      margin-bottom: 10px;
    }
    #loginform label {
      color: #ffffff;
    }
    body.login div#login form#loginform p.submit input#wp-submit {
      background-color:#bf55ec;
      border-color:#bf55ec;
      box-shadow:inset 0 -0.6em 1em -0.35em rgba(154,18,179,1),inset 0 0.6em 2em -0.3em rgba(255,255,255,0.15),inset 0 0 0em 0.05em rgba(255,255,255,0.12);}
    p#nav {
      display: none;
    }
    p#backtoblog {
      display: none;
    }
 </style>
 <?php }
 
add_action('login_head', 'wpj_custom_login_page');

 /* ------------------------ Check list ingat saya ------------------------ */
 function login_checked_remember_me() {
   add_filter( 'login_footer', 'rememberme_checked' );
 }
 
 add_action( 'init', 'login_checked_remember_me' );
 
 function rememberme_checked() {
   echo "<script>document.getElementById('rememberme').checked = true;</script>";
 }

 /* ---------------- Error Login / Salah user atau password --------------- */
 function wpj_error_login()
 {
   return "STOP!!! Ada yang salah! Coba lagi?";
 }

 add_filter('login_errors', 'wpj_error_login');
 
 /* ------------------ Redirect setelah login sesuai role ----------------- */
 function wpj_login_redirect( $redirect_to, $request, $user ) {
  if ( isset( $user->roles ) && is_array( $user->roles ) ) {
    if( in_array('administrator', $user->roles)) {
      return admin_url();
 } 
 else {
      return home_url();
    }
 } 
 else {
      return home_url();
    }
 }

 add_filter('login_redirect', 'wpj_login_redirect', 10, 3);

 /* ---------------- Tambah text/link di bagian bawah form  --------------- */
 function wpj_loginfooter() { ?>
 <p class="custom-footer-link">
 <p style="text-align:center;">Kunjungi lagi wpJakarta
 <a href="https://wpjakarta.com/wordpress/">Untuk Update Tips Trik WordPress</a></p>
 </p>
 <?php 
 }
 
add_action('login_footer','wpj_loginfooter');

 /* ---------- wpJakarta login custom ---------- */

Menambahkan keamanan pada folder wp-include

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/memperkuat-keamanan-website-wordpress/
Masukan Kode berikut pada file .htaccess :

 ## ----- Melindungi folder wp-include
 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^wp-admin/includes/ - [F,L]
 RewriteRule !^wp-includes/ - [S=3]
 RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
 RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
 RewriteRule ^wp-includes/theme-compat/ - [F,L]
 </IfModule>

Menambahkan keamanan pada file wp-config.php

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/memperkuat-keamanan-website-wordpress/
Masukan Kode berikut pada file .htaccess :

 ## ----- Melindungi file wp-config.php
 <files wp-config.php>
 order allow,deny
 deny from all
 </files>

Menon-aktifkan menu edit setiap file editor

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/memperkuat-keamanan-website-wordpress/
Untuk menutup akses file editor tersebut, tambahkan sebaris kode berikut pada file wp-config.php setelah tag : <?php:

define('DISALLOW_FILE_EDIT', true);


Redirect karena perubahan struktur URL melalui.htaccess

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/membuat-redirect-website-wordpress/
Ketikan contoh kode berikut pada file .htaccess, (Ganti dengan URL atau path yang sebenarnya).

 RewriteEngine On
 Redirect 301 /path/artikel-post-lama/ http://domain.com/path/artikel-post-baru/

Redirect http ke https melalui file .htaccess

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/membuat-redirect-website-wordpress/
Referensi Artikel : https://wpjakarta.com/wordpress/plugins/redirect-https-really-simple-ssl/
Masukan Kode berikut pada file .htaccess :

 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
 </IfModule>

Redirect Domain lama ke Domain baru

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/membuat-redirect-website-wordpress/
Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/ganti-nama-domain-website-wordpress/
Masukan Kode berikut pada file .htaccess (Ganti dengan nama domain sebenarnya).

 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^domain-lama.com$ [OR]
 RewriteCond %{HTTP_HOST} ^www.domain-lama.com$
 RewriteRule ^(.*)$ http://domain-baru.com.com/$1 [R=301,L]
 </IfModule>

Define Site URL dan Home URL

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/ganti-nama-domain-website-wordpress/
Edit wp_config.php dan masukan kode berikut sebelum : “/* That’s all, stop editing! Happy publishing. */”.

 define( 'WP_HOME', 'http://domain-baru.com' );
 define( 'WP_SITEURL', 'http://domain-baru.com' );

Define Site URL dan Home URL

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/ganti-nama-domain-website-wordpress/
Edit file function.php dan masukan kode berikut :

 <?php
 update_option( 'siteurl', 'http://domain-baru.com' );
 update_option( 'home', 'http://domain-baru.com' );

Mengaktifkan Gzip melalui .htaccess

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/membuat-website-ngebut-bagian-kedua/
Tambahkan baris kode berikut pada file .htaccess :

 <IfModule mod_gzip.c>
 mod_gzip_on Yes
 mod_gzip_dechunk Yes
 mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
 mod_gzip_item_include handler ^cgi-script$
 mod_gzip_item_include mime ^text/.*
 mod_gzip_item_include mime ^application/x-javascript.*
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
 </IfModule>
 <IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE image/x-icon
 AddOutputFilterByType DEFLATE image/svg+xml
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/x-font
 AddOutputFilterByType DEFLATE application/x-font-truetype
 AddOutputFilterByType DEFLATE application/x-font-ttf
 AddOutputFilterByType DEFLATE application/x-font-otf
 AddOutputFilterByType DEFLATE application/x-font-opentype
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
 AddOutputFilterByType DEFLATE font/ttf
 AddOutputFilterByType DEFLATE font/otf
 AddOutputFilterByType DEFLATE font/opentype
 # Browsers lama yang tidak menghandle kompresi
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 </IfModule>

Browser caching melalui .htaccess

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/membuat-website-ngebut-bagian-kedua/
Tambahkan baris kode berikut pada file .htaccess :

<IfModule mod_expires.c>
 ExpiresActive on
 ExpiresByType application/pdf A2592000
 ExpiresByType image/x-icon A2592000
 ExpiresByType image/vnd.microsoft.icon A2592000
 ExpiresByType image/svg+xml A2592000
 ExpiresByType image/jpg A2592000
 ExpiresByType image/jpeg A2592000
 ExpiresByType image/png A2592000
 ExpiresByType image/gif A2592000
 ExpiresByType image/webp A2592000
 ExpiresByType video/ogg A2592000
 ExpiresByType audio/ogg A2592000
 ExpiresByType video/mp4 A2592000
 ExpiresByType video/webm A2592000
 ExpiresByType text/css A2592000
 ExpiresByType text/javascript A2592000
 ExpiresByType application/javascript A2592000
 ExpiresByType application/x-javascript A2592000
 ExpiresByType application/x-font-ttf A2592000
 ExpiresByType application/x-font-woff A2592000
 ExpiresByType application/font-woff A2592000
 ExpiresByType application/font-woff2 A2592000
 ExpiresByType application/vnd.ms-fontobject A2592000
 ExpiresByType font/ttf A2592000
 ExpiresByType font/woff A2592000
 ExpiresByType font/woff2 A2592000
 </IfModule>

Setting file robot.txt

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/mengenal-robot-txt-dan-bagaimana-mensettingnya/
Contoh setting file robot.txt :

 User-Agent: *
 Allow: /wp-content/uploads/
 Disallow: /wp-content/plugins/
 Disallow: /wp-admin/
 Sitemap: https://example.com/sitemap_index.xml

Membuat Post paginasi

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/membuat-post-paginasi-wordpress-memisahkan-post-ke-beberapa-halaman/
Masukan kode berikut pada file single.php loop (diluar loop) :

<?php wp_link_pages(); ?>

Lalu masukan tag berikut dibagian manapun setiap artikel yang ingin dipisah :

<!--nextpage-->

Mengembalikan akses administrator

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/mengembalikan-akses-administrator-wordpress/
Ubah tabel wp_usermeta >> field wp_capabilities, dan masukan query berikut :

a:1:{s:13:”administrator”;b:1;}


Mengaktifkan breadcrumbs Yoast

Referensi Artikel : https://wpjakarta.com/wordpress/tips-trick/tips-trik-mengatasi-error-breadcrumbs-wordpress/
Tambahkan kode berikut pada content-single.php :

 /* -------- Yoast Plugin Breadcrumbs -------- */
 <?php
   if ( function_exists(‘yoast_breadcrumb’) ){
     yoast_breadcrumb( ‘<p id=”breadcrumbs”>’,‘</p>’ );
   }
 ?>

Tips Trik WordPress wpJakarta

WpJakarta Resources Tips Trik WordPress. Website dengan penerbitan-penerbitan artikel ringan tentang WordPress (Tutorial, Tips Trik, Plugin Dan Themes WordPress) dan Teknologi Informasi secara umum. Sesekali juga berbicara tentang apapun dan hal yang umum (Blogging, Tekno, Bisnis, Sosial, Budaya, Politik, Urusan Negara hingga urusan Akhirat). Serta informasi & penawaran produk digital dan non digital.