Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Wohoo, finally got this working, although, to me ‘relatively easy’ is a bit of an understatement ?? I know, I know… two lines of code, but i’m a hack/slasher and this took me a while to get working!

    My template code (will take the post ID, check if there is a template named ‘custom-post-widget-###.php and will include. Otherwise it will just return the $content as per above )

    NB: this code pulls the wordpress post ID not the number assigned to the custom posts
    I.e NOT custom_post_widget-1!!!
    templates must be name: ‘custom_post_widget-[wpPostID].php

    <?php
    if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
    	$content = apply_filters( 'the_content', $content);
    }
    echo $before_widget;
    if ( $show_custom_post_title ) {
    	echo $before_title;
    	echo apply_filters( 'widget_title',$content_post->post_title);
    	if ( $show_featured_image ) {
    		echo get_the_post_thumbnail( $content_post -> ID );
    	}
    	echo $after_title; // This is the line that displays the title (only if show title is set)
    }
    
    if (file_exists( get_stylesheet_directory(). "/custom-post-widget-{$content_post -> ID}.php")):
    include( get_stylesheet_directory() ."/custom-post-widget-{$content_post -> ID}.php");
    
    else:
    
    echo do_shortcode( $content );
    endif; 
    
    echo $after_widget;

    Thanks for your initial work/help on this guys

    Hey guys,

    Nice work on the patch and also the plugin!

    A question that both flyns’ and Johan may be able to answer:

    Is there any way to adjust your patch to pull a template created for a specific content block using the unique ID assigned to each block…

    eg. custom-post-widget-1.php <— would be applied to custom post widget id-1 and so-on

    Thanks alot,

    and keep up the great work.

    Hey WZShop. Thanks this works great…

    Do you know how to adjust this code to get multiple selectors from different catergories?

    thanks!

    actually… this css should work with any size.

    #slider-link {
    display:block;
    height:100%;
    width:100%;
    text-indent:-9999px;
    z-index:9999;}

    Hey, did you find a solution?
    I found a way using a text hyperlink and text-indent in css.

    I’m no pro, but this is what I did…

    Working with a new custom theme I’ve created based on ‘smoke-dark’,
    in the display.php file I found a couple of lines that look like this:

    <?php foreach ($postslist as $post):?>
    		<div class="FA_article <?php the_fa_class();?>" style="<?php the_fa_background(); ?>; <?php the_slider_height();?>" >
            	<div class="FA_wrap">
    				<?php the_fa_title('<h2>', '</h2>');?>

    I added this:

    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" id="slider-link" > </a>

    before the <div class="FA_wrap"> as per below…

    <?php foreach ($postslist as $post):?>
    		<div class="FA_article <?php the_fa_class();?>" style="<?php the_fa_background(); ?>; <?php the_slider_height();?>" ><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" id="slider-link" > </a>
            	<div class="FA_wrap">
    				<?php the_fa_title('<h2>', '</h2>');?>

    Within the hyperlink I added, I’ve set the ‘id’ to “slider-link”
    To match this, in the dark.css file I added a new class:

    #slider-link {
    display:block;
    height:510px;
    width:355px;
    text-indent:-9999px;
    z-index:9999;}

    NB: You would need to make different classes for different sized sliders, as the ‘slider-link’ width and height will need to vary based on the dimensions of your custom slider(s)

Viewing 5 replies - 1 through 5 (of 5 total)