Tutorials

Category

26 posts found

29 Dec 2017
0.81K
No Comments

This function I was made specially for my theme which is running in this blog. I made function because Gravatar generate random images on each user’s avatar if user not uploaded real image, this function will not work no localhost so please use domain path eg: domain.com/wp-content/themes/mytheme/images/DefaultAvatar.jpg [php] function getavatar_src($author_idOrEMAIL=0,$size=50){

Post in

29 Nov 2017
0.61K
No Comments

In Current 4.9 or preview versions we cannot get the_excerpt or get_the_excerpt by post ID so here is a little bit hack code to get excerpt paragraph of post by postID with alternate code [php] $postID=1; $postDATA = get_post($postID); $wordLength = 15; echo wp_trim_words( strip_shortcodes($postDATA->post_content) ,$wordLength); [/php

Post in

21 Jun 2017
2.53K
No Comments
Laravel custom columns login authentication

Laravel provide a great solution for login authentication, in sometimes we have typically a database table with custom table name  eg: student, customer, employee, and custom login columns eg:student_id, customer_id, employee_id but the default in Laravel authentication only use id, login and password columns. To get install laravel from composer

Post in

7 Jun 2017
2.94K
3 Comments

This is weird thing from #laravel on fresh installation, so everyone wants to remove public from url, there are two different methods. 1. Method is remove public from url in #.htaccess Create .htaccess file on main directory of laravel and put the following code [html] <IfModule mod_rewrite.c> RewriteEngine On RewriteRule

Post in

27 May 2017
3.56K
No Comments

Undefined index error occurred when you are using custom login with custom columns default #laravel use password column eg: you have defined column just like entity_password  in database and you have passed in $credential array for auth()->guard(); This is wrong for login auth [php] public function LoginAuth_Method(){ $credentials = [‘entity_email’=>’customlaravel_login@sdtuts.com’,’entity_password’=>’ThePassword!!’]; $studentAuth

Post in

23 Mar 2017
0.46K
No Comments

[php] CMD >> D:\xampp\htdocs\laravelproject>php artisan key:generate //’key’ => env(‘U9pdjHIWJtqOHvLCYoRgqFjGv2ryAdKB’), ‘key’ => env(‘ENTER HERE GENERATED VALUE’), //’cipher’ => ‘AES-256-CBC’, ‘cipher’ => MCRYPT_RIJNDAEL_128, [/php

Post in

23 Dec 2016
0.69K
No Comments
how to get category from url in wordpress

I was development a section a in my #wordpress theme I need the current category from url, here is I figure out how to get category from url. [php] $page_position = strpos($_SERVER[‘REQUEST_URI’],’page’); if($page_position!==false){ $CAT_URL = substr($_SERVER[‘REQUEST_URI’],0,$page_position); } else { $CAT_URL = $_SERVER[‘REQUEST_URI’]; } $urlslugArray = array_filter(explode(‘/’,$CAT_URL)); $get_the_category = get_category_by_slug(end($urlslugArray)); if($get_the_category){

Post in

16 Nov 2016
5.66K
No Comments

The #wordpress concatenating […] in #the_excerpt and sometimes with [&hellip]; I here function defined as trim_excerpt and it passed in add_filter you can copy and put the following code in functions.php file of your current active theme. [php] function trim_excerpt($text){     return rtrim(str_replace(‘[&hellip’, ”, $text), ‘[…]’); } add_filter(‘get_the_excerpt’, ‘trim_excerpt’); [/php] little bit information about add_filter

Post in

14 Oct 2016
3.67K
No Comments

the_category(); function is not allowing to direct change tags and attributes, get_the_category(); function return categories of posts in array so we can modify with custom html tags and attributes check out the below example code, its used in under loop of  #the_loop. [php] //Get categories $the_postid; $categories = get_the_category($the_postid); if(is_array($categories)){

Post in

26 Sep 2016
3.03K
No Comments

#wordpress is show too much text the the_excerpt, so we need to customize it for showing shorted excerpt paragraph. copy this code and paste into your current active theme’s functions.php file [php] function my_custom_excerpt_length($length){ return 100; } add_filter(‘excerpt_length’, ‘my_custom_excerpt_length’, 999); [/php] set different post excerpt length for mobile devices wp_is_mobile

Post in