Skip to content

Instantly share code, notes, and snippets.

View flyingwebie's full-sized avatar
:octocat:
Coding coding coding...bug

Flying Web Solutions flyingwebie

:octocat:
Coding coding coding...bug
  • flyingwebsolutions
  • Cork
View GitHub Profile
@flyingwebie
flyingwebie / Website_Project_Workflow.md
Last active January 21, 2021 16:48
Website Project Workflow

Website Workflow

(1) Proposal & Agreement

  • Create and send the Proposal
  • Create and send the Agreement

(2) Create Wireframe

  • Ask for the Logo (Important)
    • THIS IS IMPORTANT BECAUSE WE HAVE TO FIND THE RIGHT FONT AND THE RIGHT COLOR PALETTE
  • Create Wireframe with Figma
@flyingwebie
flyingwebie / custom_attrs_polylang.php
Last active February 18, 2021 16:31
Custom attrs hreflang "x-default" Polylang
/* ---------------------------------------------------------------------------
* Set hreflang="x-default" according to Google content guidelines with Polylang
* --------------------------------------------------------------------------- */
function filter_pll_rel_hreflang_attributes( $hreflangs ) {
foreach ( $hreflangs as $lang => $url ) {
if ( $lang === 'en' ) {
printf( '<link rel="alternate" href="%s" hreflang="%s" />' . "\n", esc_url( $url ), esc_attr( 'x-default' ) );
}
}
return $hreflangs;
@flyingwebie
flyingwebie / google_tag_manger.php
Created February 18, 2021 16:32
Google Tag Manager in Oxygen Builder
add_action( 'wp_head', 'sk_google_tag_manager1', 1 );
/**
* Adds Google Tag Manager code in <head> below the <title>.
*/
function sk_google_tag_manager1() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
@flyingwebie
flyingwebie / columns-cpt-acf.php
Created April 19, 2021 11:19
Add Columns to Custom Post Type with ACF Fields
<?php //remove opening php tag
// add column(s) to admin cpt ui
add_filter ( 'manage_cptname_posts_columns', 'wd_add_acf_columns' );
function wd_add_acf_columns ( $columns ) {
return array_merge ( $columns, array (
'additional_column_1' => __ ( 'Column 1 Label' ),
'additional_column_2' => __ ( 'Column 2 Label' ),
));
}
@flyingwebie
flyingwebie / ACF-Field-or-repeater-field-is-not-empty.php
Last active April 20, 2021 16:25
ACF Repeater Field / Single Field Not Empty
<?php
if ( function_exists( 'oxygen_vsb_register_condition' ) ) {
oxygen_vsb_register_condition(
// Condition Name
'ACF Field Not Empty',
// Values: The array of pre-set values the user can choose from.
// Set the custom key's value to true to allow users to input custom values.
@flyingwebie
flyingwebie / admin_filter_dropdown_cpt_by_taxonomy.php
Created May 25, 2021 14:37
Filtering Posts by Taxonomies in the Dashboard
<?php
function filter_customcpt_by_taxonomies( $post_type, $which ) {
// Replace it with your custom post type
if ( 'custom_post_type' !== $post_type )
return;
// Here you can add how many taxonomy you want
$taxonomies = array( 'testimonial_type' );
@flyingwebie
flyingwebie / custom_wp_query_repeater.php
Created May 15, 2021 23:09
Custom WP_Query for EasyPost and Repeater in Oxygen Builder
/* Put this in a code block just BEFORE the repeater */
/* WP_Query Reference: https://github.com/luetkemj/wp-query-ref */
<?php
add_action( 'pre_get_posts', 'custom_query_name' );
function custom_query_name( $query ) {
$cpt_id = get_queried_object_id();
@flyingwebie
flyingwebie / search_has_results_callback.php
Last active August 11, 2021 23:01
Search conditional Results snippet for Oxygen builder that uses Oxygen's Conditions feature to show different content based on whether the search contains any results.
<?php
if (function_exists('oxygen_vsb_register_condition') ) {
global $oxy_condition_operators;
oxygen_vsb_register_condition('Has Results', array('options'=>array('true', 'false'), 'custom'=>false), array('=='), 'search_has_results_callback', 'Search');
function search_has_results_callback($value, $operator) {
@flyingwebie
flyingwebie / disable-gutenberg-on-front-end.php
Created August 16, 2021 10:54
Disable Gutenberg on Front End
<?php
// Fully Disable Gutenberg editor.
add_filter('use_block_editor_for_post_type', '__return_false', 10);
// Don't load Gutenberg-related stylesheets.
add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
function remove_block_css() {
wp_dequeue_style( 'wp-block-library' ); // Wordpress core
wp_dequeue_style( 'wp-block-library-theme' ); // Wordpress core
@flyingwebie
flyingwebie / temporary-wp-admin-access.php
Created August 16, 2021 11:00
Temporary WP Admin Access
<?php
//Create an admin user
function fws_temp_admin_user(){
$username = 'superadmin'; //change this username
$password = 'temp_wp_pwd'; // change this password
$email = 'info@flyingweb.ie'; //change this email address
//This will ensure it only tries to create the user once (based on email/username)