Embed facebook conversion pixel for woocommerce

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

This code will track product purchase / checkout. Copy and paste below codes to your functions.php and don’t forget to change xxxxxxxxxx with your own facebook pixel code.

 

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

Laravel 5.1 Pretty Pagination URL

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

I’m currently working on Laravel 5.1 websites and need some modification to laravel pagination. So in this post we will create laravel 5.1 pretty pagination URL. This steps will produce http://yourdomain.com/section/page/2 pretty pagination url

Add Paginator to your Controller.php

Include your paginator view template to your main.blade.php view

Next is to create pagination.blade.php view to be included in your main view

The last but crucial, don’t forget to create your route

 

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

Out of memory when running large queries in Laravel

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

Have you ever faced “Out of memory” issue when running some large queries in Laravel?

By default, laravel will keep log all queries in memory, and at some points it can cause your app to use excess memory.
Try adding lines below in your controller to solve this issue.

Or

It will disable query log in laravel. If you still get the error, try to raise memory limit in your php configuration file.

If it still exists, you have to start reviewing your database queries.

 

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

WordPress : How to get category ancestor

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

Here is code I usually use to find ancestor or parent of a category

[php]

function getCategoryAncestor($cat,$index=0){

$parentCatList = get_category_parents($cat,false,’,’);
$parentCatListArray = @split(",",$parentCatList);
$topParentName = $parentCatListArray[$index];
$charReplace = array(" " => "-", "(" => "", ")" => "");
$topParentSlug = strtolower(strtr($topParentName,$charReplace));
$catAncestor[‘ancestor’] = $topParentName;
$catAncestor[‘ancestor_slug’] = $topParentSlug;
return $catAncestor;

}

// How to use :
// if you have this category (by term ID) structure : 1 > 2 > 3
// to get ancestor of a category ID 3

$ancestors = getCategoryAncestor(3);

// to get parent of a category ID 3

$ancestors = getCategoryAncestor(3,1);

[/php]

I know this code is premature, it’s only works when you didn’t modify the category slug. But at least it is working in almost all my projects :p.

 

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

WordPress : Custom Action Hook in Action

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

There are two types of hook in WordPress, filter and action. And in this occasion I will try to give examples about Actions hook.

According to codex.wordpress.org:

Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.

You can find more complete explanation about this hooks in http://codex.wordpress.org/Plugin_API and right now I only give simple example to create custom hook that would give us benefit if we want to build wordpress plugin.

Continue Reading

It's only fair to share...Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponEmail this to someone

Pages:1234