Skip to content

Instantly share code, notes, and snippets.

View dlucero23's full-sized avatar
💭
Hacking together a Reddit bot

Diego Lucero dlucero23

💭
Hacking together a Reddit bot
View GitHub Profile
@dlucero23
dlucero23 / functions.php
Created March 9, 2019 08:13
replace the submit input of a specific gravity form with a custom, extensively stylable button. This one is styled within Pro Theme, was inspired by this documentation: https://docs.gravityforms.com/gform_submit_button/#1-change-input-to-button-
// 03. Change All Gravity Forms Buttons to Branded Button
// =============================================================================
add_filter( 'gform_submit_button_1', 'form_submit_button', 10, 2 );
function form_submit_button( $button, $form ) {
return "
<button class='button gform_button e21-23 x-anchor x-anchor-button' id='gform_submit_button_{$form['id']}' tabindex='0' style='outline: currentcolor none medium;'>
<span class='x-anchor-content'>
<span class='x-graphic' aria-hidden='true'>
<i class='x-icon x-graphic-icon x-graphic-primary' aria-hidden='true' data-x-icon-s=''></i>
@dlucero23
dlucero23 / redirecturlsinwp.php
Last active February 12, 2019 15:03
Redirect a WP page URL without a plugin or messing with domain DNS settings. Replace the [from slug] and [to slug] below the line starting with switch with the wp slugs for each URL (ie. [from slug] would be /tos , [to slug] would be /terms-of-service)
function redirect_page() {
if (isset($_SERVER['HTTPS']) &&
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$protocol = 'https://';
}
else {
$protocol = 'http://';
@dlucero23
dlucero23 / SiamTekMetaHome.html
Created May 10, 2018 06:15
This is an example of the meta tags that would be used on https://www.siamtek.com/
<meta name="title" content="Siam Tek Web Design Group - Tampa Bay Website Design &amp; Digital Marketing">
<meta name="description" content="Siam Tek Web Design Group is a digital agency that specializes in generating revenue for clients through lead generation, client acquisition, client marketing strategy and online automation.">
<meta name="keywords" content="Tampa Bay Website Design, Tampa Bay Digital Marketing, Tampa Bay SEO">
<meta name="robots" content="index, follow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="English">
<meta name="revisit-after" content="7 days">
<meta name="author" content="Diego Lucero">
@dlucero23
dlucero23 / _brand.php
Created November 10, 2016 07:05
(To be placed in the X child theme - /framework/views/global ) Remove all h1 tags that wrap the logo, to prevent the duplicate h1 tag error, which damages SEO. Also includes the alt tag in the link "Logo".
<?php
// VIEWS/GLOBAL/_BRAND.PHP
// -----------------------------------------------------------------------------
// Outputs the brand.
// =============================================================================
$site_name = get_bloginfo( 'name' );
$site_description = get_bloginfo( 'description' );
$logo = x_make_protocol_relative( x_get_option( 'x_logo' ) );
@dlucero23
dlucero23 / WooCommerceaccountpagestyle.css
Last active June 24, 2018 00:33
Custom CSS for WooCommerce Account Page Built in Cornerstone
/*
No need for style tags here;
simply get started by writing
CSS! Watch as your changes
are reflected live in the
preview area. Have fun!
*/
.woocommerce-MyAccount-navigation-link a {
margin: 5px 5px 0 0;
padding: 15px;
<h1>Countdown Clock</h1>
<div id="clockdiv">
<div>
<span class="days"></span>
<div class="smalltext">Days</div>
</div>
<div>
<span class="hours"></span>
<div class="smalltext">Hours</div>
</div>
@dlucero23
dlucero23 / woocommerce-order-form-add-to-cart
Created June 6, 2016 22:42
If you want to add a product to the cart after gathering information via the form and then redirect to the WooCommerce checkout, add the following to the Contact Form 7 Additional Settings field. You can learn more about this technique via this link: http://www.kimwoodbridge.com/use-the-contact-form-7-plugin-to-add-a-product-to-the-woocommerce-c…
on_sent_ok: "location.replace('http://www.YOURSITE.com/checkout/?add-to-cart=ID');"
@dlucero23
dlucero23 / LandingPages-custom-post-type-addto-functions.php
Last active September 29, 2019 01:51
This useful little snippet can be added to a child theme to add a new custom post type called 'Landing Pages' which help to separate any landing pages from regular website page post_types.
// == LANDING PAGES
if ( ! function_exists('custom_post_type') ) {
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Landing Pages', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Landing Page', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Landing Pages', 'text_domain' ),
@dlucero23
dlucero23 / redirectcf7.js
Last active April 20, 2016 15:11
Redirect to URL after successful submission of a Contact Form 7 Form. To be added to the "Additional Settings (2)" section.
// after form is submitted, redirect to this domain.
on_sent_ok: "location = 'https://yourdomain.com/your-thank-you-page/';"
@dlucero23
dlucero23 / autocopyrightyear.html
Last active August 18, 2017 22:56
Auto Updating Copyright Year JS Script. Great for including in footers
<p>©2012<span id="autodate"></span> Siam Tek is a Trademark of Siam Tek Web Design Group, LLC, <br>POWERED BY <a href="//siamtek.com/solutions" title="Siam Tek Web Design Group - Digital Marketing for Online Businesses">Siam Tek - Tampa Bay Digital Marketing.</a></p>