Forum Replies Created

Viewing 11 replies - 31 through 41 (of 41 total)
  • Forum: Hacks
    In reply to: Adding custom loop to plugin
    Thread Starter aronjeney

    (@aronjeney)

    Well, I am still having troubles adding and applying my own filters, however I have been able to kindof hack the plugin code to call the html of my loop – not rocket science I know but I feel like I’m getting somewhere at least. That said, I’m really having trouble condensing my php properly either with filters or as it is now (still somewhat confused as what I need to do there).

    See my current code below.

    $_content = apply_filters( 'bawmrp_more_content', $_content, $output );
    					$thumb_size = apply_filters( 'bawmrp_thumb_size', array( 300, 300 ) );
    					$thumb = has_post_thumbnail( $id ) ? get_the_post_thumbnail( $id, $thumb_size ) : '<img src="' . $no_thumb . '" height="' . $thumb_size[0] . '" width="' . $thumb_size[1] . '" />';
    
    					$list[] = '<div class="home-property-item">
    									<div class="property-detail-block">
    										<div class="property-pic-wrapper">
    											<a href="' . esc_url( apply_filters( 'the_permalink', get_permalink( $id ) ) ) . '">' . $thumb  . '</a>
    											<h4><a href="' . esc_url( apply_filters( 'the_permalink', get_permalink( $id ) ) ) . '">' . apply_filters( 'the_title', get_the_title( $id ) )  . '</a></h4>
    										</div>
    
    									   <div class="features-wrapper">
    									   		<span class="bed"><div class="value"></div></span>
    									   		<span class="bath"><div class="value"></div></span>
    									   		<span class="size"><div class="value"></div></span>
    									   		<div class="price-box">
    							                    <h5 class="price"></h5>
    							                </div>
    							            </div>
    
    								   		<div class="learnmore">
    											<a href="' . esc_url( apply_filters( 'the_permalink', get_permalink( $id ) ) ) . '" class="blue">LEARN MORE</a>
    										</div>
    							   		</div>
    							   </div>';

    Again, I have wrapped the current thumbnail and title filters with my html. How would I go about condensing the following code to fit within the “bed” span class?

    <span class="bed"><div class="value"><?php echo get_post_meta($post->ID, 'locality_property_bedrooms', true); ?></div> <?php _e('Beds') ?></span>

    Again, really appreciate all the help. I really am trying to do this on my own but just not getting too far. Thanks again in advance!

    Forum: Hacks
    In reply to: Adding custom loop to plugin
    Thread Starter aronjeney

    (@aronjeney)

    Hey bcworkz, I really appreciate you taking the time to write all of this information. It really helps me understand the complexities of writing php on a micro scale vs macro scale as you worded it. You have definitely guided me in the right direction, however I have a lot of work to do to incorporate my php code from my template file into my function. I will continue to research more about this matter while using your input as reference. Again, thanks so much for your time. I will let you know how it turns out!

    Forum: Hacks
    In reply to: Adding custom loop to plugin
    Thread Starter aronjeney

    (@aronjeney)

    Hi again bcworkz (your hitting all my threads :). Thanks for this input. I had concluded that what you are explaining is actually how I need to do it, however I am still in question as to how I would create a function for my code above (on the macro level). I am working on this at this very moment, just very slow moving. If you could provide some insight as to how I would create a function from my code above I would be even more grateful! Thanks for all your insight so far.

    Thread Starter aronjeney

    (@aronjeney)

    Thanks bcworkz. I was actually able to solve my question just a moment ago with this code.

    global $post;
    							if ( 'property' == get_post_type() ) {
    							$tags = wp_get_post_terms($post->ID, 'property-city');
    							if ($tags) {
    								$tag_ids = array();
    
    								foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
    								$args=array(
    									'tax_query' => array(
    							        array(
    							            'taxonomy'  => 'property-city',
    							            'terms'     => $tag_ids,
    							            'operator'  => 'IN'
    							        )
    							    ),
    							    'post__not_in'          => array( $post->ID ),
    							    'posts_per_page'        => 4,
    							    'ignore_sticky_posts'   => 1
    								);
    								$my_query = new wp_query( $args );
    
    								if( $my_query->have_posts() ) { ?>

    Thread Starter aronjeney

    (@aronjeney)

    It seems that I need to strip out all the “<?php ?>” so I can add my loop inside the current php. I’m just not sure exactly how to do that properly. Can anyone provide some insight? Again, really appreciate any help!

    Is this really the only way for custom post types to work? Is there any difference in the code somewhere?

    Thread Starter aronjeney

    (@aronjeney)

    Hey Jason, thanks for the reply. Im simply trying to add more to the hook (our posts call in certain meta-key values, etc.). Where would I go about doing that in the plugin files?

    Below is my custom hook that I would like to add. Thanks for your insight!

    <div class="home-property-item">
    					                        <div class="property-detail-block">
    					                            <div class="property-pic-wrapper">
    					                               <?php
    					                                if ( has_post_thumbnail() )
    					                                {
    					                                    $image_id = get_post_thumbnail_id();
    					                                    $image_url = wp_get_attachment_image_src($image_id,'full-size', true);
    
    					                                    {
    					                                        ?>
    					                                        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    					                                        <?php
    					                                    }
    					                                                the_post_thumbnail('property-post-thumb',array(
    					                                                                        'alt'   => trim(strip_tags( get_the_title($post->ID) )),
    					                                                                        'title' => trim(strip_tags( get_the_title($post->ID) ))
    					                                                )); ?>
    					                                    </a>
    					                                    <?php
    					                                }
    					                                ?>
    
    					                                <?php
    					                                $property_status = get_post_meta($post->ID, 'locality_status', true);?>
    					                                    <p class="<?php echo $property_status; ?>">
    					                                        <?php echo $property_status; ?>
    					                                    </p>
    					                            </div>
    
    					                            <h4>
    					                                <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    					                                    <?php the_title(); ?>
    					                                </a>
    					                            </h4>
    
    					                            <div class="features-wrapper">
    					                                <span class="bed"><div class="value"><?php echo get_post_meta($post->ID, 'locality_property_bedrooms', true); ?></div> <?php _e('Beds') ?></span>
    					                                <span class="bath"><div class="value"><?php echo get_post_meta($post->ID, 'locality_property_bathrooms', true); ?></div> <?php _e('Baths') ?></span>
    					                                <span class="size"><div class="value"><?php echo get_post_meta($post->ID, 'locality_property_size', true); echo "</div> "; theme_unit(); ?></span>
    
    					                                 <div class="price-box">
    					                                    <h5 class="price">
    					                                        <?php
    					                                            theme_currency();
    					                                            echo number_format(intval(get_post_meta($post->ID, 'locality_property_price', true)));
    					                                        ?>
    					                                    </h5>
    					                                </div>
    
    					                            </div>
    
    					                            <div class="learnmore">
    					                                <a class="blue" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">LEARN MORE</a>
    					                            </div>
    					                        </div>
    					                    </div>

    @brokenflipside thanks for implementing this. I cant seem to link the thumbnail to the post without breaking the code. How would I wrap $the_thumbnail with<a href="' . get_permalink( $post_id ) . '" title="' . get_the_title( $post_id ) . '">?

    Thanks in advance!

    Thread Starter aronjeney

    (@aronjeney)

    OK thanks, I will give that a try. thanks for your help so far!

    Thread Starter aronjeney

    (@aronjeney)

    Hey Andrew, thanks for the reply. I have tried that before and although that does work I am filtering by builder in another page of my site and when I list the homes as their names (without the underscores) they add spaces to my URL (creating %20), causing issues with the filter. I wonder if this is in fact the route I need to go and find a jquery or something that will allow me to strip the spaces from the url. Any ideas as to how I do that? Thanks again for your help so far!

    Thread Starter aronjeney

    (@aronjeney)

    Can anyone help me with this? I am still struggling to call the proper option value from my selected meta key. Any help is greatly appreciated!

Viewing 11 replies - 31 through 41 (of 41 total)