Skip to content

Instantly share code, notes, and snippets.

View barrykooij's full-sized avatar
:shipit:
I may be slow to respond.

Barry Kooij barrykooij

:shipit:
I may be slow to respond.
View GitHub Profile
<?php
function dlm_modify_download_url( $url ) {
// todo modify your URL here
$url = str_ireplace( "://domain.com/download/", "://domain.com/index.php/download/", $url );
return $url;
}
add_filter( "dlm_download_get_the_download_link", "dlm_modify_download_url" );
<?php
function dlm_pa_search_prior_results() {
if ( ! empty( $_GET['download_search'] ) ) {
// template handler
$template_handler = new DLM_Template_Handler();
//show search box
$template_handler->get_template_part( 'search-downloads', '', plugin_dir_path( DLM_PA_FILE ) . 'templates/' );
}
<?php $excerpt = wp_trim_words( strip_tags( strip_shortcodes( ( ( '' != $related_post->post_excerpt ) ? $related_post->post_excerpt : $related_post->post_content ) ) ), $excerpt_length ); ?>
<p><?php
global $post;
$o_post = $post;
$post = $related_post;
echo apply_filters( 'rp4wp_post_excerpt', $excerpt, $related_post->ID );
$post = $o_post;
?></p>
function rp4wp_exclude_category( $sql, $post_id, $post_type ) {
global $wpdb;
if ( 'post' !== $post_type ) {
return $sql;
}
// get term with slug 'past-events'
$term = get_term_by( 'slug', 'past-events', 'category' );
$term2 = get_term_by( 'slug', 'uncategoried', 'category' );
#hb-wrap #main-wrapper #main-content .container .row .page .hb-main-content p .dlm-tc-submit {
width: 100%;
text-align: center;
text-decoration: none;
padding: 1.5em 1em !important;
color: #fff;
display: block;
font-size: 1.2em;
line-height: 1.5em;
background-color: #0099cc;
function dlm_pa_only_with_tags( $args ) {
$args['tax_query'][] = array(
'taxonomy' => 'dlm_download_tag',
'field' => 'slug',
'terms' => array( 'tag1', 'tag2' )
);
return $args;
}
<?php
/**
* Default output for a download via the [download] shortcode
*/
global $dlm_download, $dlm_page_addon;
?>
<a class="download-link" href="<?php echo $dlm_page_addon->get_download_info_link( $dlm_download ); ?>" rel="nofollow">
<?php $dlm_download->the_title(); ?>
</a>
function rp4wp_disable_rposts_on_certain_categories( $display ) {
global $post;
// ID's of categories you wish to exclude of displaying posts
$excluded_categories = array( 96, 100 );
$terms = wp_get_object_terms( $post->ID, 'category' );
if ( ! empty( $terms ) ) {
foreach ( $terms as $term ) {
if ( in_array( $term->term_id, $excluded_categories ) ) {
function rp4wp_wp_job_manager_use_normal_template( $located, $template_name, $args, $template_path, $default_path ) {
if ( 'related-post-default.php' === $template_name && 'job_listing' === $args['related_post']->post_type ) {
$manager_template = new RP4WP_Manager_Template();
$located = $manager_template->locate_template( 'related-post-default.php', $template_path, $default_path );
}
return $located;
}
remove_action( 'wpcm_vehicle_content', 'wpcm_template_single_features', 30 );
add_action( 'wpcm_vehicle_content', 'wpcm_template_single_features', 5 );