Skip to content

Instantly share code, notes, and snippets.

David Ryan dryan1144

Block or report user

Report or block dryan1144

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dryan1144
dryan1144 / filter-taxonomy-term-url.php
Created Jul 26, 2017
Filter taxonomy term URLs for SF Pro
View filter-taxonomy-term-url.php
<?php
function hck_filter_taxonomy_archives( $url, $sfid) {
if (is_tax('topics')) {
$slug = get_queried_object()->slug;
$url = site_url() .'/'. get_post_type() .'/'. $slug;
}
return $url;
View rewrite-shared-terms-archives.php
<?php
function hck_rewrite_post_types() {
add_rewrite_rule('^articles/([^/]*)/?','index.php?post_type=articles&topics=$matches[1]','top');
add_rewrite_rule('^questions/([^/]*)/?','index.php?post_type=questions&topics=$matches[1]','top');
add_rewrite_rule('^amas/([^/]*)/?','index.php?post_type=amas&topics=$matches[1]','top');
View cpt-with-shared-taxonomy.php
<?php
function hck_questions_cpt() {
$labels = array(
'name' => _x( 'Topics', 'healthcarekit' ),
'singular_name' => _x( 'Topic', 'healthcarekit' ),
'search_items' => __( 'Search Topics', 'healthcarekit' ),
'all_items' => __( 'All Topics', 'healthcarekit' ),
'parent_item' => __( 'Parent Topic', 'healthcarekit' ),
View filter-sf-pro-query.php
<?php
function hck_filter_taxonomy_archives( $query_args, $sfid ) {
if( $sfid == 509 ) {
$query_args = array(
'post_type' => 'articles',
);
@dryan1144
dryan1144 / woocommerce-functions.php
Last active Dec 25, 2018
Change WooCommerce order confirmation text in
View woocommerce-functions.php
<?php
add_filter( 'woocommerce_thankyou_order_received_text', 'my_custom_order_received_text' );
function my_custom_order_received_text() { ?>
<div class="order-received-text">
<h5>Your Order Was Successful!</h5>
<p>Congratulations and a huge thank you for registering with us!</p>
<p>You will receive a confirmation email shortly. If you have questions, please do not hesitate to <a href="/contact">contact us</a></p>
<p>Thanks again!</p>
View woocommerce-titles.php
<?php
if (is_product()) {
echo '<h1>Register</h1>';
} elseif (is_cart()) {
echo '<h1>Review Order</h1>';
View woocommerce-breadcrumbs.php
<?php if (is_product() || is_cart() || is_checkout() || is_wc_endpoint_url('order-received')) {
if (is_product()) {
echo '<h1>Register</h1>';
} elseif (is_cart()) {
echo '<h1>Review Order</h1>';
View slides.php
<?php //Slides loop
$args=array(
'post_type' => 'slide', //this is your cpt name
'post_status' => 'publish',
'posts_per_page' => -1, //this is the max number of slides
'orderby' => 'menu_order',
'order' => 'ASC'
);
$slide_query = new WP_Query($args);
@dryan1144
dryan1144 / functions.php
Created Apr 27, 2015
Hide pages from search results
View functions.php
<?php
add_filter('pre_get_posts','your_custom_search_filter');
function your_custom_search_filter($query) {
if (!is_admin() && $query->is_search) {
$exclude_ids = array(1,2,3); //page ids you want to exclude
$query->set('post__not_in', $exclude_ids);
}
View functions.php
<?php
/*
Change Place Order button text on checkout page in woocommerce
*/
add_filter('woocommerce_order_button_text','custom_order_button_text',1);
function custom_order_button_text($order_button_text) {
You can’t perform that action at this time.