bellaelysium
Forum Replies Created
-
Hello!
Yes, I tried doing that too but it still doesn’t work!
It gave this error:
Fatal error: Cannot redeclare penci_get_featured_image_size()I am surprised too. No idea why though. Let me know if you figure that out as I am curious too!
It still work when I add that missing bracket, together with the if clause.Hey..it works perfectly fine for now as I just checked everything. Thanks so much! ??
- This reply was modified 7 years, 9 months ago by bellaelysium. Reason: good byes :)
- This reply was modified 7 years, 9 months ago by bellaelysium.
I manage to get it to work…again adding that line (No idea why???)
<?php /** * Plugin Name: Nelio Tweaks to Support Penci Theme * Version: 1.0.0 * * Author: Nelio Software * Author URI: https://neliosoftware.com * License: GPL-2.0+ * License URI: https://www.gnu.org/licenses/gpl-2.0.txt * * @author David Aguilera <[email protected]> * @since 1.0.0 */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } if ( ! function_exists( 'penci_get_featured_image_size' ) ){ function penci_get_featured_image_size( $id, $size = 'full' ) { // Nelio Tweak. if ( class_exists( 'Nelio_Content_External_Featured_Image_Helper' ) ) { $aux = Nelio_Content_External_Featured_Image_Helper::instance(); $efi_url = $aux->get_nelio_featured_image( $id ); if ( is_string( $efi_url ) && strlen( $efi_url ) ) { return $efi_url; } // Original function code. if ( ! has_post_thumbnail( $id ) ) { return ''; } else { $image_html = get_the_post_thumbnail( $id, $size ); preg_match( '@src="([^"]+)"@', $image_html, $match ); $src = array_pop( $match ); return $src; } } } }
But hey, really so much thanks for making it work! A+ help there! ??
This was the first error before I add that line:
Fatal error: Cannot redeclare penci_get_featured_image_size() (previously declared in /home3/bellaelysium/public_html/wp-content/themes/soledad/functions.php:1047)Are you sure about this? I mean, does it only work with the if clause?
Somehow, it just deactivate and said its fatal error. I have no idea why when I add this line it works. Okay here’s the code I put in so far, but it gave me fatal error.
Parse error: syntax error, unexpected end of file in …<?php /** * Plugin Name: Nelio Tweaks to Support Penci Theme * Version: 1.0.0 * * Author: Nelio Software * Author URI: https://neliosoftware.com * License: GPL-2.0+ * License URI: https://www.gnu.org/licenses/gpl-2.0.txt * * @author David Aguilera <[email protected]> * @since 1.0.0 */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { die; } function penci_get_featured_image_size( $id, $size = 'full' ) { // Nelio Tweak. if ( class_exists( 'Nelio_Content_External_Featured_Image_Helper' ) ) { $aux = Nelio_Content_External_Featured_Image_Helper::instance(); $efi_url = $aux->get_nelio_featured_image( $id ); if ( is_string( $efi_url ) && strlen( $efi_url ) ) { return $efi_url; } // Original function code. if ( ! has_post_thumbnail( $id ) ) { return ''; } else { $image_html = get_the_post_thumbnail( $id, $size ); preg_match( '@src="([^"]+)"@', $image_html, $match ); $src = array_pop( $match ); return $src; } }
Is there anything wrong with it?
Hi,
My theme is not free. It’s Soledad theme (in case you have it). DOes it works with other free themes by mass auto set featured images using the last image of post?
If yes, let me know how I can send it to you.
Okay, I add in one more line and it works great.
if ( ! function_exists( 'penci_get_featured_image_size' ) ) {
However, it only works if I set the feature image in my post. However, it doesn’t automatically set feature image by taking the last image of my post. I have like many older entries which I can’t do it one by one.Is there any solution? It works last time.
Hello,
I have tried that but it doesn’t work.
Hi,
Thanks for the reply!
DO I use that code you gave and replace with the first function of the theme code?
I am noob in this but what you mean by custom plugin of mine?Thanks!