May 4, 2011

Media attachment in custom field | CyberSEO Pro | Support Forums

Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_topicicon
Media attachment in custom field
Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 (0 votes) 
October 2, 2020
11:01 am
Avatar
Member
Members
Forum Posts: 54
Member Since:
February 16, 2016
sp_userofflinesmall Offline

Hi,

I’m usually able to add a value from a xml element <url> to a custom field. e.g. $post[‘custom_fields’][‘video_url’] = trim($xml_tags[‘url’][‘val’]);

were <url>Login to see this link.;

Now in this feed a media attachment is defined with the <enclosure> attribute

Login to see this link.

<enclosure url=”https://content.kink.com/imagedb/5699/v/h/320/hires/5699_7.mp4″ length=”0″ type=”video/mp4″/>

CyberSEO is able to add it to the post with the media attachment setting. However, I would like to send the attachment URL to the custom field $post[‘custom_fields’][‘video_url’]

$post[‘custom_fields’][‘video_url’] = $post[‘media_content’] and $post[‘custom_fields’][‘video_url’] = $post[‘enclosure_url’] obviously doesn’t work

October 3, 2020
2:48 pm
Avatar
Admin
Forum Posts: 3134
Member Since:
July 2, 2009
sp_userofflinesmall Offline

Everytime you want to see the post content you can do the following:

1) Look at the XML structure of the post in the feed settings.

2) Just type print_r($post) in the PHP field.

You will see all the fields there that you can use.

October 5, 2020
10:29 am
Avatar
Member
Members
Forum Posts: 54
Member Since:
February 16, 2016
sp_userofflinesmall Offline

Thanks for you fast reply,

I’m not sure I understand these steps? Do you mean in step 1 to view the XML structure in the feed settings preview mode? And I do not understand were to type print_r($post”).

I can see three structures in the feed settings Preview Mode:

1) Post Content

2) Attachment

3) XML structure

In the raw XML feed I see <enclosure url=”https://content.kink.com/imagedb/5699/v/h/320/hires/5699_7.mp4″ length=”0″ type=”video/mp4″/>. So CyberSEO sees the Attachment and can add it to the post in Basic settings.

If I add %enclosure_url% to the Advanced>Post content field I get the URL in the Post.

However, in the Feed Setting Preview Mode XML structure I see <enclosure></enclosure>.

So, How can I tell CyberSEO to add the enclosure URL ”https://content.kink.com/imagedb/5699/v/h/320/hires/5699_7.mp4″ to the custom field $post[‘custom_fields’][‘video_url’]?

October 5, 2020
12:39 pm
Avatar
Admin
Forum Posts: 3134
Member Since:
July 2, 2009
sp_userofflinesmall Offline

Yes, I’m talking about the XML structure. It shows the XML fields that you can use. It works for JSON, CSV and even HTML sources – CyberSEO turns everything into XML automatically.

As about the “%enclosure_url%”. Course you will get the URL there because it’s the URL. If you need to turn it into an image, you should do something like this:

Login to see the code.

Login to see the code.

October 5, 2020
12:44 pm
Avatar
Admin
Forum Posts: 3134
Member Since:
July 2, 2009
sp_userofflinesmall Offline

You don’t need to code anything. Just copy-paste it into the “Advanced>Post content” box.

October 6, 2020
2:51 pm
Avatar
Member
Members
Forum Posts: 54
Member Since:
February 16, 2016
sp_userofflinesmall Offline

OK.

I see I need to clarify something here:

Login to see this link.

I’ve made a screenshot of what I mean. This theme uses a Custom field “video_url” any mp4 video is displayed as a tube video. The Post content is displayed as text under the video. I do not want a video attachment in the post but in the custom field “video_url”. I will keep it in mind if I need to use the blog though.

In the Advanced>PHP code field I use code to send a video URL to this custom field.

e.g. $post[‘custom_fields’][‘video_url’] = trim($xml_tags[‘url’][‘val’]); in this example the XML tag “url” (<url>content url</url>) contained the video mp4 url

Somehow, I cannot find the correct code for CyberSEO in this particular feed:

Login to see this link.

<enclosure url=”https://content.kink.com/imagedb/5699/v/h/320/hires/5699_7.mp4″ length=”0″ type=”video/mp4″/>

October 15, 2020
3:23 pm
Avatar
Admin
Forum Posts: 3134
Member Since:
July 2, 2009
sp_userofflinesmall Offline

You can do it like this:

Login to see the code.

October 20, 2020
11:57 am
Avatar
Member
Members
Forum Posts: 54
Member Since:
February 16, 2016
sp_userofflinesmall Offline

admin said
You can do it like this:

<br />

$post['custom_fields']['video_url'] = $post['enclosure_url'];

  

Hi, That works. However I tried that at first and it didn’t work. Now it does. Nevertheless TNX

October 20, 2020
12:52 pm
Avatar
Admin
Forum Posts: 3134
Member Since:
July 2, 2009
sp_userofflinesmall Offline

That means there was some mistake in your code which you just overlooked.

Forum Timezone: Europe/Moscow

Most Users Ever Online: 105

Currently Online:
10 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ninja321: 81

Freedom: 61

B8europe: 54

saviulisse67: 45

adultdenim: 44

allgoodies: 38

Member Stats:

Guest Posters: 353

Members: 1944

Moderators: 0

Admins: 1

Forum Stats:

Groups: 1

Forums: 2

Topics: 1342

Posts: 6704

Administrators: CyberSEO: 3134