12:39 pm
December 17, 2022
Hello,
I have written some code to extract the featured image from non-compliant feeds and I want to use it in many feeds. I have been copy pasting it but every time I need to make a change I have to go through all the feeds.
Is there a way to create a function that can be called from with the CSEO PHP field in the feed setup?
I created a function in a code snippet that is set to run everywhere but when I try to call it from CSEO i get an error. The function should return an array of values.
--Call to function
$mfi_cseo = cseo_featuredthumb('fulltext', $mfi_post_link, trim($mfi_post_content), '');
--Error
[13-03-23 11:03:50] Executing user-defined PHP code
[13-03-23 11:03:52] Error: Undefined constant "cseo_featuredthumb"
I'm not sure I've got it. You say you defined a function in PHP code snippet. The CyberSEO Pro PHP snippet is a function itself, so you can't define any functions there. You can just call them in your snippets if they are defined elsewhere.
Usually the theme's functions.php file is being used as a place that contains all user-defined functions: Login to see this link
2:16 pm
December 17, 2022
Sorry, I should've explained better.
I'm using the Code Snippets plugin (Login to see this link) which allows me to add code snippets that run across the website with directly editing the functions.php file. I'm using for adding so custom code for other functions and automating stuff as well.
So, hypothetically, we can say that the function is indeed inside the functions.php file. Would I be able to call it from the feed's PHP field?
Depends which plugin runs first by WordPress. If CyberSEO Pro is being launched before that plugin, then the functions, declared there won't be loaded. Otherwise they will be available like any WordPress API functions or functions defined in your theme or other plugins.
That's why functions.php is a 100% working solution and is suggested for custom-defined functions in all WordPress manuals.
Most Users Ever Online: 541
Currently Online:
13 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
ninja321: 84
s.baryshev.aoasp: 68
Freedom: 61
Pandermos: 54
MediFormatica: 49
B8europe: 48
Member Stats:
Guest Posters: 337
Members: 2817
Moderators: 0
Admins: 1
Forum Stats:
Groups: 1
Forums: 5
Topics: 1626
Posts: 8272
Newest Members:
igor.buzaev, jeremyboucher, lthompson2709, MAC, duty3canada, backlinkmoroccoAdministrators: CyberSEO: 3909