Skip to content

Instantly share code, notes, and snippets.

View digisavvy's full-sized avatar

Alex Vasquez digisavvy

View GitHub Profile
// Start of Selection
// Initialize the arguments for the WP query to fetch various post types
$args = array(
'post_type' => ['post', 'session', 'resource', 'video'], // Define post types to query
'posts_per_page' => -1, // Set to '-1' to fetch all posts. Replace with a specific number if needed
'order' => 'DESC', // Order by descending to get the most recent or viewed first
// You can add more arguments here as per your query requirements
);
// Retrieve the most viewed posts using a function provided by the Post Views Counter plugin
<?php
/**
* Removes specified nodes from the WordPress admin bar.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/
function remove_from_admin_bar( $wp_admin_bar ) {
// Conditional check to limit removal to non-admin area pages
if ( ! is_admin() ) {
// Remove 'comments' and 'editor_mode' nodes from the admin bar
/* File: automatic.css - Version: 2.7.2 - Generated: 2023-11-11 07:24:44 */
:root, .color-scheme--main {
--action: #010136;
--action-hover: #01013f;
--action-ultra-light: #e6e6fe;
--action-light: #b4b4fd;
--action-medium: #0505fa;
--action-dark: #03037d;
--action-ultra-dark: #010132;
--action-comp: #373701;
<?php
/**
* Plugin Name: STT Tracking for Google Tag Manager
* Version: 1.0
* Description: Push transaction details into the GTM Data Layer.
* Author: Pablo Tocho, of DigiSavvy
* Author URI: https://digisavvy.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
add_action('wp_head', 'dgs_add_new_relic_agent');
function dgs_add_new_relic_agent() { ?>
// New Relic Agent Javascript Tag Here
<?php }
<?php
function dgs_function_with_current_time() {
// Get the current date and time based on your WordPress settings
// 'Y-m-d H:i:s' will return the date and time in 'YYYY-MM-DD HH:MM:SS' format
return current_time('Y-m-d H:i:s');
}
<?php
$video_id = get_post_meta(get_the_ID(), 'session_video_file_download', true);
if ($video_id) {
$video_url = wp_get_attachment_url($video_id);
if ($video_url) {
$shortcode = '[presto_player src="' . esc_attr($video_url) . '"]';
$player_output = do_shortcode($shortcode);
echo $player_output;
}
}
SELECT *
FROM wp_postmeta
WHERE post_id = {your_post_id}
AND post_id IN (SELECT ID FROM wp_posts WHERE post_type = '{your_posttype}');
With the above query, replace {your_post_id} and {your_posttype} with the appropriate post ID and posttype.
{"content":[{"id":"xjassy","name":"container","parent":"lgznqb","children":["oyosks"],"settings":{"_display:mobile_landscape":"block","_display":"none","_cssCustom:mobile_landscape":".table-row {\n background-color: var(--bricks-color-zqxmyk) !important;\n}\n"},"label":"Mobile Table"},{"id":"oyosks","name":"block","parent":"xjassy","children":["kyskls","yutqfe","bfghtd","zgafvm","rutdaj","odijlh","napgsg","qmqlih","ncwhow","bpchxc","wlsqmb","ypulps","jaqieg","uzmgvr"],"settings":{"_display:tablet_portrait":"grid","_gridGap:tablet_portrait":"1","_gridTemplateColumns:tablet_portrait":"1fr 1fr","_cssCustom":".div-table-mobile > div {\n padding: 1em;\n}\n\n.div-table-mobile {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-auto-rows: minmax(0px, 1fr);\n}\n\n\n.div-table-mobile > * {\n\ttext-align: center;\n}\n\n.div-table-mobile > div {\n background: #fff;\n}\n\n.div-table-mobile {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n background-color: var(--bricks-
{"content":[{"id":"xezkft","name":"container","parent":"lgznqb","children":["rzvkzk"],"settings":{"_display:mobile_landscape":"none","_cssCustom":"/* .div-table > div:nth-child(-n+3) {\n background: var(--bricks-color-zqxmyk);\n} */\n\n.div-table > div:nth-child(3n-8) {\n background: var(--bricks-color-zqxmyk);\n}\n\n.div-table > div {\n max-height: 120px;\n}","_cssCustom:tablet_portrait":".div-table > div {\n max-height: 150px;\n}","_cssCustom:mobile_landscape":".div-table > div {\n max-height: 170px;\n}"},"label":"Desktop Table"},{"id":"rzvkzk","name":"block","parent":"xezkft","children":["eymaow","oxmriy","jbhbyl","xywekp","ukbfut","zlurfz","dlxndd","ohhagr","bopokw","wbmlzg","rxydhh","btzhtv","kqxfaj","sbdivc","imlayu"],"settings":{"_display":"grid","_cssCustom":".div-table > div {\n padding: 1em;\n}\n\n.div-table {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-auto-rows: minmax(100px, 1fr);\n}\n\n.div-table > div {\n background: #fff;\n}\n\n.div-table {\n