Skip to content

Instantly share code, notes, and snippets.

@omurphy27
omurphy27 / Bootstrap Tabs used with Advanced Custom Fields ACF PHP JS HTML.php
Last active February 4, 2025 21:32
Bootstrap Tabs used with Advanced Custom Fields ACF PHP JS HTML
<?php if( have_rows('tabs') ): ?>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<?php $i=0; while ( have_rows('tabs') ) : the_row(); ?>
<?php
$string = sanitize_title( get_sub_field('tab_title') );
?>
<li role="presentation" <?php if ($i==0) { ?>class="active"<?php } ?> >
<a href="#<?php echo $string ?>" aria-controls="<?php echo $string ?>" role="tab" data-toggle="tab"><?php the_sub_field('tab_title'); ?></a>
</li>
<?php $i++; endwhile; ?>
@omurphy27
omurphy27 / PHP Wordpress Removing Contact Form 7 Br tags when adding to template.html
Created March 15, 2013 00:27
PHP Wordpress Removing Contact Form 7 Br tags when adding to template
<!-- adding Contact Form 7 into Wordpress Template and removing <br> tags
add the following to the wordpress template -->
<?php echo do_shortcode('[contact-form-7 id="211" title="Spanish Contact Form"]') ; ?>
<!-- add the following into the wp-config.php -->
define ('WPCF7_AUTOP', false );
<!-- This will remove the <br> tags that get added automatically when you call Contact Form 7 from the template via shortcode-->
@omurphy27
omurphy27 / PHP truncate string - cut string after certain length - output shorter string.php
Created May 21, 2014 17:55
PHP truncate string - cut string after certain length - output shorter string.php
<?php
// http://stackoverflow.com/questions/3161816/php-cut-a-string-after-x-characters
function truncate_string($string,$length=70,$append="...") {
$string = trim($string);
if(strlen($string) > $length) {
$string = wordwrap($string, $length);
$string = explode("\n",$string);
$string = array_shift($string) . $append;
@omurphy27
omurphy27 / echo-enqueued-styles-scripts-wordpress.php
Last active August 31, 2024 13:04
Wordpress - Print Out All Enqueued Scripts And Styles On A Page
<?php
// add the below to your functions file
// then visit the page that you want to see
// the enqueued scripts and stylesheets for
function se_inspect_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2><ul>";
foreach( $wp_styles->queue as $handle ) :
echo "<li>" . $handle . "</li>";
@omurphy27
omurphy27 / Google My Maps Embed Change Zoom Level .html
Created February 18, 2015 19:03
Google My Maps Embed - Change Zoom Level
// Google Maps change zoom level
// just append &amp;z=15 at the end of src url
<iframe src="https://www.google.com/maps/d/embed?mid=zFZSXubrjIbQ.kTtvWjBE06QI&amp;z=15" width="640" height="480"></iframe>
@omurphy27
omurphy27 / Open-link-in-new-window-and-print-js-javascript.js
Created August 5, 2015 20:30
JS / HTML open Link to Image in New Window and Print Image
@omurphy27
omurphy27 / wp_query_woocommerce_product_category.php
Last active November 9, 2023 23:05
Wordpress WP_Query in WooCommerce for a Product Category aka Taxonomy which is ordered by a Custom Field
<?php
$args = array(
'posts_per_page' => 7,
'post_type' => 'product',
'product_cat' => 'home-featured',
'meta_key' => 'home_featured_order',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
@omurphy27
omurphy27 / transparent background image pattern overlay.css
Created March 26, 2013 04:59
CSS Transparent Background Image Pattern Overlay
/*Transparent pattern placed over an image, like we see on the bootstrap homepage: http://twitter.github.com/bootstrap/index.html*/
div {
width: 200px;
height: 200px;
display: block;
position: relative;
background: url(images/background-image.png);
}
@omurphy27
omurphy27 / WooCommerce - Change Wrapping Markup through Main Content Action Hook.php
Last active September 10, 2022 04:21
WooCommerce - Change Wrapping Markup through Main Content Action Hook.php
<?php
// add core markup to woocommerce pages
add_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper');
// overwrite existing output content wrapper function
function woocommerce_output_content_wrapper() {
echo '<div class="main-bg no-top-banner">
<div class="container">
<div id="content" class="row" >
<div id="main" class="col-md-9 pull-right clearfix" >';
@omurphy27
omurphy27 / Gravity Forms WP CSS Honeypot styling.css
Last active June 20, 2022 02:10
Gravity Forms WP CSS Honeypot styling.css
.gform_validation_container,
.gform_wrapper .gform_validation_container,
body .gform_wrapper li.gform_validation_container,
body .gform_wrapper .gform_body ul.gform_fields li.gfield.gform_validation_container,
body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container {
display: none !important;
position: absolute !important;
left: -9000px;
}