Skip to content

Instantly share code, notes, and snippets.

WPML plugin is used for making the multi lingual website.
This will allow user to add transalted version of posts, category, page, product etc.
WPML use the parse_query hook to modify query. Using this filter WPML adds query modification.
The argument suppress_filters is used for removing the filter added in the query
like posts_search, posts_search_orderby, posts_where etc. All these type of queries will execute if the suppress_filters is false.
Default value of suppress filter is false in the WP_Query. So it will return only the posts in the current language.
But get_posts() return all the posts in the posts. because suppress_filters is true in this function by default.
@junaidtk
junaidtk / Enable Xdebug in MAC
Created November 21, 2019 04:59
Formatting the var_dump in MAMP
This is used to formate the debuging mode of the MAMP.
Here we need to enable the xdebug module in mamp in php ini file.
There are two different php ini file in, The locations are following.
/Applications/MAMP/bin/php/php7.3.8/conf/php.ini ---- In bin folder
/Applications/MAMP/conf/php7.3.8/php.ini ---- In conf folder
In bin folder open php.ini file and uncomment the line
zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
@junaidtk
junaidtk / Basic command and description
Created August 6, 2020 07:36
Basic command line code used by developer.
grep
==============
Grep search a specific patten in each file
$ grep "some string" file
Search a string in a specific.
@junaidtk
junaidtk / Selenium Automation
Created August 8, 2020 09:32
Web Automation Testing using Selenium and Python
Web Automation Testing using Selenium and Python
=================================================
First you need to check the python is already installed in the system.
In order to check this just type the below command
$ python or $ python3
It will result the as given below
@junaidtk
junaidtk / Python Installation
Created August 8, 2020 11:22
Install Python and Create local environment
Install Python and Create local environment
===============================================
Some basic Commands to note i your memory
check selenium is installed or not.
===========================================
$ python3 -c "import selenium; print(selenium.__version__)"
@junaidtk
junaidtk / CSS naming convention
Created August 12, 2020 07:49
CSS Naming Conventions
Below is the naming conventions for HTML structure.
=====================================================
Names are written in lowercase Latin letters.
Words are separated by a hyphen (-).
The block name defines the namespace for its elements and modifiers.
The element name is separated from the block name by a double underscore (__).
@junaidtk
junaidtk / Development Tools in chrome
Created August 14, 2020 05:02
Chrome Advanced Development tools
Chrome Advanced Development tools
==================================
Chrome Command Menu
-------------------
The command menu in chrome help many powerfull feature in the chrome page.
Command + shift + P provide the command menu. where we can use many command operations.
1) Powerfull screenshots
Screenshot Capture full size screenshot : Full size screenshot of the complete page
Screenshot Capture node screenshot : Current node screenshot. You can select the node from the Elements tab
@junaidtk
junaidtk / WP-Cron Jobs
Created August 14, 2020 05:22
How to create a basic Cron job scheduling in WP
WP-Cron Jobs
=============
Wp-Cron handles scheduling time-based tasks in WordPress. Several WordPress core features, such as checking for updates and publishing scheduled post, utilize WP-Cron.
WP-Cron works by checking, on every page load, a list of scheduled tasks to see what needs to be run. Any tasks due to run will be called during that page load.
Scheduling errors could occur if you schedule a task for 2:00PM and no page loads occur until 5:00PM.
With WP-Cron, all scheduled tasks are put into a queue and will run at the next opportunity (meaning the next page load). So while you can’t be 100% sure when your task will run, you can be 100% sure that it will run eventually.
@junaidtk
junaidtk / Name space
Last active May 11, 2022 12:43
PHP Namespace Concepts
While creating large applications, then there may be chances of collision between class names, function names.
So to avoid these problems PHP "Namespaces" provide a way in which to group related classes, interfaces, functions and constants.
In the PHP world, namespaces are intended to take care of two issues
that creators of libraries and applications experience when making re-usable code components, Those are:
1.Name impact between code you create, and internal PHP classes/functions/constants or third-party classes/functions/constants.
2.Ability to abbreviate Extra_Long_Names for improving the readability of source code.
@junaidtk
junaidtk / javascript variable types : var, let, const
Last active March 2, 2021 10:28
Javascript variable and its declaration
These are three type of javascript variabe declaration.
var
====
Function scoped or globally Scoped.
Reassignable and Redeclarable
Not subject to temporal dead zone.
var language = "JavaScript";
function foo() {
var language = "Python";