Wordpress
install Steps :
1) Download latest wordpress https://wordpress.org/download/
2) Extract WordPress zip to the C:/wamp/www/ folder.
3) phpmyadmin create database name "WP"
3) open your WordPress folder, find the wp-config-sample.php file and rename it wp-config.php. Open the file key in all database user (root), password, dbname (WP)
4) go to http://localhost/wordpress/
5) Install wp, password D*W6LsuWv^b)5Jxv9N , Username zac1987
6) Open wp-config.php file again and add/edit the following lines
define('WP_DEBUG', true);
define('WP_ALLOW_MULTISITE', true);
7) http://localhost/wordpress/ > Tools > Network Setup > email > Install.
8) at Tools > Network Setup > Copy 1st group of code and paste below step (6) codes on wp-config.php become :
define('WP_DEBUG', true);
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/wordpress/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
9) at Tools > Network Setup > copy 2nd group of code then paste it into .htaccess file.
10) click Appearance > Theme > search and install theme
11) click menus > choose EITHER Page or Posts or Custom Links then click "Add to Menu". So Menu is parent. Page/ Posts / Custom Links are chidren.
----------------------------------------------------------------------------------
Two ways to create new widget :
1) Edit function.php in theme folder.
a. create new widget, go to directory (wp-content > themes > themes name > function.php).
b. write all php code at last line in function.php page.
c. Then go to Appearance > Widgets > move your new widget to sidebar.
------
2) Safer way bcuz wont mass with theme original code, create code in plugin folder, then activate plugin, then move widget to side bar.
a) go to plugin folder, create new folder name myOwn-plugin, then in the new folder open a new php file name myOwn-plugin.php then copy paste the code :
/*
Plugin Name: Site Plugin for example.com
Description: Site specific code changes for example.com
*/
/* Start Adding Functions Below this Line */
/* Stop Adding Functions Below this Line */
?>
b) Then write your new plugin code at the middle of the comment line at code above. Then save the php file. Then go to plugin section activate the plugin, then go to Appearance > Widgets > move my new plugin
to side bar.
c) In the code, front-end mean visitor see how the widgetlook like. Back-end mean admin see how the widget at sidebar panel look like.
code dictionary :
The constructor, to initiate the widget
The form() function to create the widget form in the administration
The update() function, to save widget data during edition
And the widget() function to display the widget content on the front-end
add_action("wp_head", "awepop_add_view");
wp_head is like document_ready in jquery call function when document is finish load. wp_head load first before
tag in most themes.
-----------------------------------------------------------
create database intergret plugin
You can check what is ur wp database name prefix by 2 ways :
1) in wp-config.php find the line $table_prefix = 'wp_';
2) echo $wpdb->prefix ;
------------------
error Notice: The called constructor method for WP_Widget in phayupload_Widget is deprecated since version 4.3.0! Use
__construct()
just replace $this->WP_Widget( to parent::__construct(
--------------------
to register widget location for our theme
1) open new file function.php, then put in the following code :
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'sidebar',
'before_widget' => '
'after_widget' => '
', 'before_title' => '
'after_title' => '
?>
----------------------
body close tag should be at sidebar.php because side bar is the last element of layout
-----------------------
hide admin bar, just need to create new plugin
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
---------------------
change thumbnail picture size :
//Default WordPress
the_post_thumbnail( 'thumbnail' ); // Thumbnail (150 x 150 hard cropped)
the_post_thumbnail( 'medium' ); // Medium resolution (300 x 300 max height 300px)
the_post_thumbnail( 'medium_large' ); // Medium Large (added in WP 4.4) resolution (768 x 0 infinite height)
the_post_thumbnail( 'large' ); // Large resolution (1024 x 1024 max height 1024px)
the_post_thumbnail( 'full' ); // Full resolution (original size uploaded)
//With WooCommerce
the_post_thumbnail( 'shop_thumbnail' ); // Shop thumbnail (180 x 180 hard cropped)
the_post_thumbnail( 'shop_catalog' ); // Shop catalog (300 x 300 hard cropped)
the_post_thumbnail( 'shop_single' ); // Shop single (600 x 600 hard cropped)
------------
add remove field at "Post a Listing" page :
I have apply css display:none on div of selling type field at plugins/marketengine/templates/posting-listing/type.php line 30
---------------
show grid custom post type :
Two differance ways :
1) install and active grid post plugin, then add shortcode to theme/zeroengine/index.php by code below :
$params = array('posts_per_page' => 20, 'post_type' => 'listing');
$wc_query = new WP_Query($params);
?>
2) redirect homepage to the page that show all products :
Add code below to themes/zeroengine/functions.php :
function redirect_homepage() {
if( ! is_home() && ! is_front_page() )
return;
wp_redirect( '/wordpress/listings', 301 );
exit;
}
add_action( 'template_redirect', 'redirect_homepage' );
-----------------------
for display header slide on only 1 page that has url "listings" :
global $wp;
$wholeURL = home_url( $wp->request );
$lastPart = array_slice(explode('/', rtrim($wholeURL, '/')), -1)[0]; //get last part of url
if( $lastPart === "listings" ) :
echo do_shortcode("[advps-slideshow optset='1']");
endif;
-------------------------
sort top menu
if ur menu links are from pages, go to each pages edit the order number.
----------------------------
post grid
if want add/remove description / read more button / date / author , go to Post Grid > Layout > Content Layout Edit > add them.
If want to edit Title font size, go to Post Grid > Layout > Content Layout Edit > Click Title, edit css
----------------------
migrate from localhost to online web hosting :
1) download Duplicator plugin at https://wordpress.org/plugins/duplicator/
2) follow the steps at https://wpdean.com/how-to-move-wordpress-from-localhost-to-live-host-server/
2) Admin dashboard > duplicator > package > Create New >
3) if error "Error establishing a database connection", then open phpMyAdmin check 4 tables :
a) wp_blogs :
domain : www.funbeli.com
path : /
domain : http://www.2aek.com/funbuy
path : /funbuy/
b) wp_options :
siteurl : http://www.funbeli.com
home : http://www.funbeli.com
siteurl : http://www.2aek.com/funbuy
home : http://www.2aek.com/funbuy
click page 2 Then :
c) wp_site :
domain : http://www.funbeli.com
path : /
domain : http://www.2aek.com/funbuy
path : /funbuy/
d) wp_sitemeta :
siteurl : http://www.funbeli.com
siteurl : http://www.2aek.com/funbuy
Then edit wp-config file in wp folder :
define('DOMAIN_CURRENT_SITE', 'www.funbeli.com');
define('PATH_CURRENT_SITE', '/');
define('DOMAIN_CURRENT_SITE', 'www.2aek.com');
define('PATH_CURRENT_SITE', '/funbuy');
Then go to wp-admin save permenent link
error cannot open other pages because u didnt re-save permenent link
--------------
to edit widget css :
go to edit the file at directory wordpress/wp-content/plugins/plugin name/ public/css/wpp.css
---------------
to modify layout :
1) you need to find the folder name. (copy any keyword from the website, search folder), mostly in wordpress/wp-content/plugins/marketengine or template folder.
2) on the website, press f12 on chrome find the css class on the website content.
3) use dreamweaver find the css class keyword in the folder that u found on step 1.
4) Dont edit the file, just create a new page on that folder.
--------------
to make ur website exatly the same as demo, u need to :
1) Apperance > Menus > manage Locations > Primary Menu set to demo menu.
2) Apprance .> themeoption > header > choose other type to match demo header
3) zip revolution slider folder, then go to slider > import > zip file. Then go to page > homepage > add slider to body content.
4) if woocommerce catalog image size too big or homepage product listings image size too big, maybe because all image dont have thumb size yet, u need go to regenerate all image to thumb. (Tools > Regenerate
Thumbnails). Or go to Appearance > General > Main Body Content Width : Container Fluid
--------------------------------------
For plugin and theme update in future, steps :
1) finish edit all plugin and theme.
2) clone folder into 2nd copy, rename it with Zac- prefix.
3) Deactivate original plugin/theme.
4) Activate Zac- prefix plugin/theme.
5) When future receive new update, update the original 1.
6) If website look weird, then clone original plugin/theme and rename it Zac2- prefix.
7) Activate Zac2-prefix, and move all my own codes into Zac-2 prefix plugin/theme.
-------------------------------
Shop page not at center :
Appearance > Theme Options > Woocommerce > Archive Product > select side bar NONE
Edit woocommerce shop page :
Appearance > Theme Options > Woocommerce > Archive Product
--------------------------------
shop page hide "quick view" button :
Appearance > Theme Option > Custom Code > and put
.archive .btn-quickview{display:none}
in CSS Code.
-----------------------------------
click seller name go to store profile, dont use default dokan store profile because it need user troublesome key in lot of infor for setup store during new acc registeration before login, somemore
differenciate seller and buyer, mean buyer wont have store profile page. I want both seller and buyer have profile page, so it is better create own profile page.
--------------------------------
create php file must save in theme/template folder then only can appear at Page Attributes Template field when creating a new page in admin area.
-------------------------------
hook lists :
echo $author_name; (pure php)
echo get_the_author(); (wp hook)
zac1987 author.php must save in theme root folder which has archive.php
the_author_posts_link(); (wp hook)
--------------------------------
loop listing in a page for custom post type (product) :
'post_type' => 'product',
'posts_per_page' => 12,
'author_name' => $curauth->nickname
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();
?>
More arg parameters can be found at https://codex.wordpress.org/Class_Reference/WP_Query
-----------------------------------
If want to copy the output from 1 page to another page, u need to call the php function from theme functions.php. Eg : gearside_online_users();
-----------------------------------
All hook start from the example the_author_post_link() / the_author_id() is already contain echo, so php variable $blabla = the_author_id(); wont work, must add "get" infront of "the" only will work. Example
$blabla = get_the_author_id();
------------------------------------
if u want to change the setting in any plugin, go to wordpress.org find the plugin page, see the screenshort or description.
------------------------------------
if u want to add css style. Just go to deskboard > themes option > custom code > css.
or appearance > customize > css
------------------------------------
cannot find any page in menu? Click page 2 because too many pages, so it might be at 2nd page or 3rd page.
--------------------------------
dashboard > comment > tick display avatar
---------------------------------
if hover link, see redirect to page_trashed, mean u have delete the page in trash, go to page > trash > restore the page.
--------------------------------
if u think plugin developer block u not allow u customize by his code:
jz add jquery :
jQuery(document).ready(function ($) {
});
---------------------------------
U can direct put jquery code to wordpress but it will cause alot of blank spacing on the page. If u dont want so much blank spacing on ur page, u need include jquery to the page in proper way. 3 steps :
1) include wp built in jquery file.
2) include ur custom file that has your jquery code.
3) wrap your jquery code by (function($){...........})(jQuery);
function theme_scripts() { //include wordpress built-in jquery file
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'theme_scripts');
function add_my_script() { //include my page that has my jquery code
wp_enqueue_script( 'checkProductAvtiveTabJS', plugins_url('/zac-hook/checkProductActiveTab.js'), array('jquery'), true );
}
add_action( 'wp_enqueue_scripts', 'add_my_script' );
my jquery code must be wrapped by :
(function($){...........})(jQuery);
--------------------------------------
click "My Account" at top menu, left menu like order, download, my wallet, account detail, cannot function because need to go woocommerce > setting > Accounts > My account page : choose the correct page. The
correct page must has woocommerce account function (page > search "woocommerce account"> add it to the page > save).
-----------------------------
hide breadcrumbs
there are 3 page setting to disable breadcrumbs:
1) appearance > theme options > breadcrumbs
2) appearance > theme options > woocommerce > breadcrumbs
3) appearance > theme options > woocommerce > single page breadcrumbs configure
-----------------------------
if dokan page such as dashboard/store/my orders not working then :
dokan permalinks setting :
1) setting > permalinks > common settings : post name
2) setting > permalinks > product permalinks > custom base : /product
Then go to pages > click "view" on dashboard page. If still cannot works then try following solution :
1) Pages > Search dashboard / order / store, delete those dokan pages > must empty the trash, bcuz if dokan detect the shortcode on page in trash, then ur new page wont works.
2) create the 3 new pages : Dashboard [dokan-dashboard] / Store Listing [dokan-stores] / My Orders [dokan-my-orders]
3) click "view" to test the page.
If still now working, then delete all pages, emptry trash, inactive dokan plugin, activate dokan plugin, create 3 new pages for dokan.
-----------------------------
if wordpress avatar gone, open phpmyadmin > wp database > wp_usermeta table > find meta_key field wp_2_user_avatar, change it to wp_user_avatar. It is because multisite change wp_user_avatar to
wp_2_user_avatar.
-------------------------------
if home page is not same as demo
then go to wp-admin > settings > reading > set homepage to static page > static page choose SHOP ( u need to create new page for SHOP)
if shop page not show products, mean ur post is not product, u need install woocommerce then create product, not create post.
-------------------------------
Problem : pictures / images blur in responsive mobile view.
Solution : Download "Regenerate Thumbnails" plugin. Then use Google Chrome Inspector to check your website blurry image class = "thumbnail" or "Post-Thumbnails" or "Featured-Image". If it is "Post-Thumbnails" then go to upload image there click "Regenerate Thumbnails" and make sure Green color Tick on "Post-Thumbnails" as screenshot below :
Solution 2 :
Reason : you upload photo is too small size, so wordpress cannot resize it to thumbnail and featured image.
Solution : So you need to upload bigger size photo, so that wordpress can resize it to thumbnail size. Your picture won't be blurry if using the thumbnail photo that been Resized by Wordpress before.
If still blur, then set the thumb size picture with css style="height:80px;"
If still blur, then don't use thumb size, but change to use medium size with css style="height:80px;"
-------------------------------
Show Product Categories :
Appearance > Customize > Woocommerce > Product Catelog > Shop page display :Show Categories
Then design the page by going to Page > Shop > Edit : Header Script :
-------------------------------
Change 1 product per column to 2 products per column :
For desktop:
Woocommerce > Setting > Column Count : 5
For Mobile:
Appearance > Customize > Additional CSS :
If import sql file to phpmyadmin FAIL because sql file size is bigger than 50mb, then you may zip the sql file to reduce size.
glove-malaysia sql file size is 80mb.
If white color blank page with error :
Solution is open the error_log file check syntax error, correct all syntax error. Mostly all from woocommerce plugin php pages got syntax error.
Critical Error : Go to wp_config.php to delete define( 'WP_DEBUG', false ); , then add the following codes :
Then load the problem page again. Then go to wp-content/debug.log to check the error and fix the error.
Upload file size limit : 28mb to 128mb
Go to cpanel > select php version > option > file max size upload : 128
Make all images size become the same by croping:
Reverse Image Search plugin Google Visual API :
Go to wordpress plugin folder create new folder name "Reverse-Image-Search" then put in the PHP file into the folder.
Then open the file wp-content/themes/davici/search-form.php add the following shortcode:
Or login your wordpress admin dashboard > page > homepage > edit the homepage by Elementor / Wpbakery / Gutenberg or adding HTML Block editor to add the shortcode :
If mobile view the theme hide the header and move search button to footer, then follow this tutorial
0 comments