Using XML entity as featured image instead of embedded post image

Hi All,

Let me start off by saying I'm working with some really crappy, custom XML feeds which don't validate and are a bit of a nightmare.

This is the feed URL I'm working with at the moment:

If you don't have the patience to try and see the feed structure I've removed the text so you can see how it's structured:

So my issue is that the posts contained in the feed don't always contain images and if they do, they are not the images I want to use as the featured image. What I want to do is grab the image contained in this XML entity:

<focus-block type="image/jpeg" url=""></focus-block>

Is there a way to get Autoblog to pull in the image specified in the entity instead of in the post itself?

FYI: I have featured image import activated for the plugin and it's successfully attaching images to the post so I know the plugin is working 100% - it's just this issue I'm having that will solve ALL of my problems.

I thank you guys in advance!

  • aecnu

    Greetings Justin,

    Welcome to WPMU DEV!

    Thank you for the great question but this is one I am going to have to refer to the lead developer because I have not heard of this being done in the past and do not know how to do it if it is indeed possible.

    Therefore I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Barry

    You would have to build / modify an add-on to look for the relevant tag and grab the image from it.

    Have a look at the featured image add-on and you will see the functions that it uses - you could edit this file or make a new file and paste the contents in and edit the new file.

    The function check_post_for_images is the function that is called by the autoblog plugin to do the additional processing. It is passed 3 parameters

    1. post_ID - which is the Id of the post that has just been created in your system
    2. ablog - which is the feed item and has all the options that were entered on the feed edit form
    3. item - which is the simplepie item for the current post in the feed.

    If the image you are looking for is in a custom tag within the post content then you can change what is being looked for in the regular expression in get_remote_images_in_content

    If it is outside the content / description in the feed, then you can use some simplepie methods on the $item object to find the image instead.

    Hope that made sense

  • aecnu

    Greetings Justin and Barry,

    @Barry Thank you Chief for that great input and explanation and I am sure it is appreciated by the member and certainly on my part.

    @Justin It appears this particular topic is now resolved/closed, if you need any further assistance please let us know.

    If it wasn't resolved, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Thank you for being a WPMU Dev Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.