- Download & Install Sublime Text 3.2.2 Build 3211
- Visit https://hexed.it/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Custom WP query to get posts by current product category slug | |
$args = array( | |
'post_type' => 'post', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => $cats[0], | |
'posts_per_page' => 4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$term = get_queried_object(); | |
$tax_query = array( | |
array( | |
'taxonomy' => 'product_cat', | |
'field' => 'id', | |
'terms' => $term->term_id, | |
'include_children' => false // If you want to disable subcategories | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml import html | |
import requests | |
from operator import itemgetter, attrgetter, methodcaller | |
# IMDB search listing page for "Animated movies 2015" | |
page = requests.get('http://www.imdb.com/search/title?genres=animation&sort=moviemeter,asc&title_type=feature&year=2015') | |
tree = html.fromstring(page.content) | |
# This will create a list of movie names | |
get_names = tree.xpath('//td[@class="title"]/a/text()') |