Forum Replies Created

Viewing 15 replies - 16 through 30 (of 43 total)
  • Thread Starter searay

    (@searay)

    Thanks for the replies, I solved the problem with css. Thanks again. Can I ask the mods to strip the link from my post, please? Thanks

    Thread Starter searay

    (@searay)

    How can I test if the thumbnail image is generated by some other function than the_post_thumbnail?
    Isn’t 10 the max the filter priority can take?

    Thread Starter searay

    (@searay)

    Thanks for reply, @girlieworks. That code still doesnt work. Maybe Im doing something wrong here. Here is the link to my site http://goo.gl/5ww6QK What I want to do is assign affiliate link to the thumbnail image (small square on the left in the head section). It should work the same as the Buy Now button on the right, but at the moment there’s no link attached to it. The $GLOBALS[‘ghostpool_affiliate_button_link’] stores the link that I enter when creating new page in admin. Could it be that Im trying to use the same variable for both button and thumbnail and this work only for button? Should I create another meta box for the thumbnail link?

    • This reply was modified 9 years, 7 months ago by searay.
    Thread Starter searay

    (@searay)

    Thanks Steve, that works magic, with one exception, how can I choose which child pages to display and which not? It displays all of them(four in my case), and I want to have only two specific child pages. Also it doesnt display Read more link.

    UPDATE:
    I was able to add “Read more…” link, but still can’t figure out how to catch the desired child pages. Well, I could use some CSS tricks for that, but hoping for some php solution first.

    Thread Starter searay

    (@searay)

    Looks like the problem is with the JS. Everytime I change the thumbnail to something else i.e

    echo "no thumbnail";

    Im getting exactly what I want to get with the street view…
    This is the JS code, can you help me with re-working that?

    <div id="street-view" style="height:163px;"></div>
     <div id="street-view2" style="height:163px;"></div> // my modification
                    <script>
                        /* Property Detail Page - Google Map for Property Location */
    
                        function initialize_property_map(){
    
                            var propertyMarkerInfo = <?php echo json_encode( $property_marker ); ?>
    
                            var url = propertyMarkerInfo.icon;
                            var size = new google.maps.Size( 42, 57 );
    
                            // retina
                            if( window.devicePixelRatio > 1.5 ) {
                                if ( propertyMarkerInfo.retinaIcon ) {
                                    url = propertyMarkerInfo.retinaIcon;
                                    size = new google.maps.Size( 83, 113 );
                                }
                            }
    
                            var image = {
                                url: url,
                                size: size,
                                scaledSize: new google.maps.Size( 42, 57 ),
                                origin: new google.maps.Point( 0, 0 ),
                                anchor: new google.maps.Point( 21, 56 )
                            };
    
                            var propertyLocation = new google.maps.LatLng( propertyMarkerInfo.lat, propertyMarkerInfo.lang );
                            var propertyMapOptions = {
                                position: propertyLocation,
                                pov: {
                heading: 34,
                pitch: 10
              }
    
                            };
                            var propertyMap = new google.maps.StreetViewPanorama(document.getElementById("street-view"), propertyMapOptions);
                            var propertyMap2 = new google.maps.StreetViewPanorama(document.getElementById("street-view2"), propertyMapOptions); //my modification
    
                        }
    
                        window.onload = initialize_property_map;
                    </script>

    What I tried to add to this code is commented on the right and this worked only showed two instances of street view in one post preview. Strange, why I can get two in one, but can’t get one in two separate posts?! Is this has something to do with dynamic callout of ID in <DIV>?? Thanks for any input.

    Thread Starter searay

    (@searay)

    I solved the problem myself. Just used the same variable in php just with different naming in the square brackets and after updating javascript that works fine! No major changes to the javascript code needed which is great news also. Thanks @bcworkz for your help!

    Thread Starter searay

    (@searay)

    UPDATE:

    I managed to pass the agent id with a link into the javascript using the code structure that was already in place. Which means I replaced the link that was linking to the property with the link that is linking to agent’s page. Success!
    This is the code I used:

    $post_data = $post->ID;
            $agent_id = get_post_meta($post_data, 'REAL_HOMES_agents',true);
            if(!empty($agent_id)) {
            $current_prop_array['url'] = get_permalink($agent_id);
            }

    The only question now is how can I pass both links in one variable $current_prop_array[‘url’]? I want to keep the property link at least for an image thumbnail. If there is no option for that I would need to probably define another variable in javascript or maybe there are other easier ways? Im guessing.. as always.
    Thanks for your great help @bcworkz, again I learned a lot here. Still hoping for more.

    Thread Starter searay

    (@searay)

    Great, thanks! I was able to make a link that works in php, but having troubles to pass that info with agent ID to the javascript.

    All the info is stored in the $properties_data variable, how can I pass the Agent ID to it? I tried with the code below and no luck, cause I don’t know how to define another url in javascript.

    That’s the part of the code pasted above with my modification.

    /* Agent ID */
    
    				 $post_data = $post->ID;
    
             $agent_id = get_post_meta($post_data, 'REAL_HOMES_agents',true); 
    
             $current_prop_array['builder'] = $agent_id[0];

    and this is part of the javascript from the same code above which I can’t make it to work to show the link with Agent ID on the infoview window.

    var innerHTML = "";
                    if ( properties[i].thumb ) {
                        innerHTML += '<a class="thumb-link" href="' + properties[i].url + '">' +
                                    '<img class="prop-thumb" src="' + properties[i].thumb + '" alt="' + properties[i].title + '"/>' +
                                    '</a>';
                    }
    
                    innerHTML += '<h5 class="prop-title"><a class="title-link" href="' + properties[i].url + '">' + properties[i].title + '</a></h5>';
    
                    if ( properties[i].price ) {
                        innerHTML += '<p><span class="price">' + properties[i].price + '</span></p>';
                    }
    
                    innerHTML += '<div class="arrow-down"></div>';
    
                    boxText.innerHTML = innerHTML;

    Have a question, can the “url” in the code below consist more than one link? Or do I need to define another variable similar to “properties” and assign new “url” to it?

    innerHTML += '<h5 class="prop-title"><a class="title-link" href="' + properties[i].url + '">' + properties[i].title + '</a></h5>';

    Just to make it easier Im pasting the code from above again here.

    Thread Starter searay

    (@searay)

    I did what you asked and found at least two agent IDs associations. snapshot here I see two associations there. Well, third one REAL_HOMES_property_contractor is a metabox in admin created by me for the purpose of displaying agent’s name on the property preview.
    Anyways.. the REAL_HOMES_agents is the one I need I think. The second one, REAL_HOMES_agent_display_option is used for the agents dropdown. So the ID would be 1062. What’s next?

    Thread Starter searay

    (@searay)

    I don’t think there is agent post ID in the property’s meta, but to be honest I don’t know. How can I check that?

    This is the code of the page that shows single property and an agent assigned to it in the bottom.

    And this is the code for that bottom part. It works as a separate template and it’s called by get_template_part(‘property-details/property-agent’); function.

    I tried to find any relation between agent and property but with no luck. I hope you can help me with this.

    Thread Starter searay

    (@searay)

    Ok, I partly solve my problem, the map is working good now and showing only the posts that I wanted to.
    All I needed to add was an array within an array.

    Now, when the markers are clicked they show property thumbnail with the link to this property page. What I want, is to add another link below with that property’s Agent name that links to the agent’s page. Can you guide me through the WP_Query to get appropriate posts? Or maybe there is a better way?

    I know I need to edit javascript for that, I more less know where and how, what I do not know is how to pass the data with relevant agent’s ID and link it to the agent’s page. With only one agent it would very easy, but when I have 180 agents…

    Here is the code I’m referring too link

    Thread Starter searay

    (@searay)

    Yes, postmeta is the table that stores my meta box data. And I am not SQL whiz unfortunately, but I have some knowledge about it.

    Maybe I will show you what kind of sorting I need, here is the link

    The difference is I need to sort Builders posts not projects as in the link above. Here is the link to the builders list by star rating(taken from YASR plugin) or “2015 Projects” numerical value metabox.

    I looked at the code for sorting projects and it looks like this

    <div class="sort-controls">
        <strong><?php _e('Sort By','framework');?>:</strong>
        &nbsp;
        <?php
        if ( isset( $_GET['sortby'] ) ) {
            $sort_by = $_GET['sortby'];
        } else {
            if ( is_page_template( array (
                'template-property-listing.php',
                'template-property-grid-listing.php',
                'template-map-based-listing.php',
                ) ) ) {
                $sort_by = get_post_meta( get_the_ID(), 'inspiry_properties_order', true );
            } else {
                $sort_by = get_option( 'theme_listing_default_sort' );
            }
        }
        ?>
        <select name="sort-properties" id="sort-properties">
            <option value="default"><?php _e('Default Order','framework');?></option>
            <option value="price-asc" <?php echo ( $sort_by == 'price-asc' ) ? 'selected' : '' ; ?>><?php _e('Price Low to High','framework');?></option>
            <option value="price-desc" <?php echo ( $sort_by == 'price-desc' ) ? 'selected' : '' ; ?>><?php _e('Price High to Low','framework');?></option>
            <option value="date-asc" <?php echo ( $sort_by == 'date-asc' ) ? 'selected' : '' ; ?>><?php _e('Date Old to New','framework');?></option>
            <option value="date-desc" <?php echo ( $sort_by == 'date-desc' ) ? 'selected' : '' ; ?>><?php _e('Date New to Old','framework');?></option>
        </select>
    </div>

    It looks similar to pre_get_post option you mentioned. Well, you’re right, I am overwhelmed now…

    Thread Starter searay

    (@searay)

    How can I do Agent’s custom ID field? I was thinking maybe by creating custom meta box in the admin? As I can see all the agents IDs, I could type them in manually, but this is slow process, are there any other options?

    Thread Starter searay

    (@searay)

    That’s very useful info @jancbeck, thanks. However, after I applied your code the link is still pointing to the property’s page and not the agent’s. Looks like the REAL_HOMES_agents doesn’t store his ID.
    I did some digging and found this code, which might store the agent’s ID, after some trials and errors I was able to pass the agent ID into the link and it’s linking to his page also, but the only problem now is that it always show the same agent on every property. image here
    Here is the code I found:

    // Agents
            $agents_array = array(-1 => __('None', 'framework'));
            $agents_posts = get_posts(array('post_type' => 'agent', 'posts_per_page' => -1, 'suppress_filters' => 0));
            if (!empty($agents_posts)) {
                foreach ($agents_posts as $agent_post) {
                    $agents_array[$agent_post->ID] = $agent_post->post_title;
                }
            }

    and the code I use now which returns the same value on every property instead the value that is assigned to every single property:

    <h5 class="price">
                 <?php  $agents_array = array(-1 => __('None', 'framework'));
            $agents_posts = get_posts(array('post_type' => 'agent', 'posts_per_page' => -1, 'suppress_filters' => 0));
            if (!empty($agents_posts)) {
                foreach ($agents_posts as $agent_post) {
                    $agents_array[$agent_post->ID] = $agent_post->post_title;
                }
            } ?>
                  <a href="<?php echo get_permalink($agent_post); ?>"><?php echo get_the_title($agent_post); ?></a>
    
                </h5>

    BTW: Many thanks for both of you @jancbeck and @bcworkz for all the help, I learned a lot here.

    Thread Starter searay

    (@searay)

    I changed:

    if( !empty($post_meta_data['REAL_HOMES_property_contractor'][0]) ) {
                    $prop_contractor = $post_meta_data['REAL_HOMES_property_contractor'][0];

    to:

    if( !empty($post_meta_data['REAL_HOMES_agents'][0]) ) {
                    $prop_contractor = $post_meta_data['REAL_HOMES_agents'][0];

    and now instead of agent’s name it shows his ID, still linking to property though, but I think we’re close…

Viewing 15 replies - 16 through 30 (of 43 total)