Skip to content

Instantly share code, notes, and snippets.

@wpflames
wpflames / content-archive.php
Created March 16, 2022 12:15
template-parts / content-archive.php
<div class="card">
<h4>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h4>
<div class="meta">
<?php the_date(); ?>
</div>
<?php the_excerpt(); ?>
@wpflames
wpflames / style.scss
Created March 16, 2022 12:13
Archive Pagination SCSS
// Archive Pagination
/************************************/
.navigation.pagination {
a.page-numbers {
border: 1px solid rgba(0, 0, 0, 0.3);
color: black;
padding: 10px;
text-decoration: none;
&:hover {
background: black;
@wpflames
wpflames / archive.php
Created March 16, 2022 12:05
Archive with numbered pagination
<?php
// Archive
/************************************/
defined( 'ABSPATH' ) || exit;
get_header();
?>
@wpflames
wpflames / functions.php
Created March 8, 2022 08:28
Add hreflang attribute to head section
<?php
// =============================================================
// ADD HREFLANG ATTRIBUTE TO HEAD SECTION
// =============================================================
function add_hreflang_attr_to_head(){
$blog_id = get_current_blog_id();
// ENGLISH
@wpflames
wpflames / functions.php
Created March 7, 2022 12:07
Event snippet for conversion page
<?php
// =========================================================================
// CONVERSION TRACKING THANK YOU PAGE
// =========================================================================
function add_conversion_tracking_thank_you_page() {
echo '
<!-- Event snippet for https://**********.com/ conversion page -->
<script>
gtag("event", "conversion", {
@wpflames
wpflames / functions.php
Created March 7, 2022 12:05
Global tag
<?php
// =========================================================================
// ADD GOOGLE ANALYTICS GLOBAL TAG TO WP_HEAD
// =========================================================================
function add_global_tag_for_ads() {
echo '
<!-- Global site tag (gtag.js) - Google Ads: ************ -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW************script>
<script>
@wpflames
wpflames / functions.php
Created February 25, 2022 15:26
Display Product Price with VAT in Single Product WooCommerce
<?php
// =========================================================================
// DISPLAY PRODUCT PRICE WITH VAT
// =========================================================================
function display_product_price_with_vat(){
global $product;
$brutto_ar = wc_get_price_to_display( $product );
$netto_ar = $brutto_ar/127*100;
$netto_ar_rounded = round($netto_ar);
$netto_ar_plus_afa = $netto_ar_rounded .' Ft + 27% áfa';
@wpflames
wpflames / social.php
Created February 24, 2022 16:39
Social Icons SVG
<ul class="social">
<li>
<a href="">
<svg data-icon="facebook" height="30" aria-hidden="true" focusable="false" data-prefix="fab" class="fa-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"></path></svg>
</a>
</li>
<li>
<a href="">
<svg data-icon="twitter" height="30" aria-hidden="true" focusable="false" data-prefix="fab" class="fa-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-
@wpflames
wpflames / functions.php
Created February 16, 2022 11:52
Check if multiple categories is in the cart
<?php
// =========================================================================
// CHECK IF THERE IS MULTIPLE CATEGORY IN THE CART
// =========================================================================
function custom_msg_to_specific_cats(){
$flower_in_cart = false;
$gift_in_cart = false;
// Flower - Loop through all products in the Cart
@wpflames
wpflames / functions.php
Created February 15, 2022 18:32
Disable Specific Shipping Method based on Category
<?php
// =========================================================================
// UNSET SPECIFIC SHIPPING METHOD BASED ON CATEGORY IN THE CART
// =========================================================================
function unset_shipping_based_on_category( $rates) {
$gift_in_cart = false;
// Gift
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( has_term( 'nem-virag', 'product_cat', $cart_item['product_id'] ) ) {