aarondurber01
-
Posts
5 -
Joined
-
Last visited
Posts posted by aarondurber01
-
-
my fault for bad explanations, new to this
I have a clients website that runs wordpress 4.4, it uses an expert agent feed and the all in one import wordpress plugin to import the feed. I then need to display the node details. i have used the code above after a google search. to reiterate i am new to this and not an expert in PHP or xml.
thanks
-
Still struggling.
i am using wordpress 4.4, an expert agent feed and expert agent plugin to deliver the feed.
I need to query the rooms node (as above) each room has a size and description node. i would like to display this data on a wordpress post page. i can pull individual node details and sub nodes using code i found with google search.
<?php if(get_post_meta($post->ID, 'entrance_hall_name', true) || // this is what i have named the node for room name get_post_meta($post->ID, 'entrance_hall_desc', true) || // this is what i have named the node for room description get_post_meta($post->ID, 'entrance_hall_size', true) || // this is what i have named the node for room size ): ?> <?php if(get_post_meta($post->ID, 'entrance_hall_name', true)): ?> <b><?php echo get_post_meta($post->ID, 'entrance_hall_name', true); ?></b> <br> <?php if(get_post_meta($post->ID, 'entrance_hall_desc', true)): ?> <?php echo get_post_meta($post->ID, 'entrance_hall_desc', true); ?> <?php endif; ?> <br><br> <?php if(get_post_meta($post->ID, 'entrance_hall_size', true)): ?> <?php echo get_post_meta($post->ID, 'entrance_hall_size', true); ?> <? php echo "<br><br>"; ?> <?php endif; ?> <?php endif; ?> <?php if(get_post_meta($post->ID, 'sep_wc_name', true)): ?> <?php echo get_post_meta($post->ID, 'sep_wc_name', true); ?> <?php endif; ?> <br><br> <?php endif; ?>
I want to loop through the rooms node returning the values for those that are there, not all rooms have a sizeall help appreciated. -
i'll give that a try thanks.
-
I am using an expert agent XML feed to populate a clients estate agent website.
Below is a snap shot of the nodes. I wish to loop through the rooms node using PHP to display the room name, then the size, then the description. Is there an easy way/simple solution to accomplish this within PHP?
<property reference="xxxxx"> <main_advert></main_advert> <street>Kenilworth Walk</street> <brochure>xxxxx</brochure> <property_type>House</property_type> <rooms> <room name="Entrance hall"> <measurement_text/> <description> with radiator, carpet. </description> </room> <room name="Separate WC"> <measurement_text/> <description> with low level WC, hand basin, double glazed UPVC window, radiator, carpet. </description> </room> <room name="Lounge"> <measurement_text> 13' 10'' x 15' 8'' (4.21m x 4.77m) </measurement_text> <description> with double glazed UPVC french doors and windows to garden, carpet, two radiators. </description> </room> </rooms> </property>
I am not a php expert, I'd appreciate any help or guidance.
Using PHP to loop through XML nodes
in Other
Posted
i got the code from here
https://perishablepress.com/wordpress-custom-fields-tips-tricks/
$post is the variable for the post item/page, no its from the standard wordpress install, i think.
the code pull the data from the node entrance_hall_name (which i have named)
entrance_hall_name maps to the rooms node, room name attribute and displays on screen.
Am i still explaining myself really badly?