forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: Nymheria on May 28, 2016, 07:09:08 pm

Title: CpmFetch php code not working in sidebar widget
Post by: Nymheria on May 28, 2016, 07:09:08 pm
Hello,

I'm new to fansites and this forum so I hope I'm not doing anything wrong by writing here but I'm desperate about an issue happening on my fansite. I wanted to have the "latest images added to the gallery" in a sidebar's widget on my site, so I did everything I had to do with cpmfetch and it all went all as the CpmFetch Installer was showing me the thumbnails of the latest uploads in my gallery.

However, when I'm copying/pasting the code I'm given in the widget, here is what is appearing instead of the thumbnails :

cpm_viewLastAddedMedia(1,4); $objCpm->cpm_close(); ?>

Did I do something wrong ?

By the way, I have WordPress 4.5.2 and Coppermine 1.5.42 (stable) and my gallery is at roselesliesource.com/gallery/

Thank you !
Title: Re: CpmFetch php code not working in sidebar widget
Post by: Αndré on May 30, 2016, 10:14:08 am
That's an issue you probably have to ask in the Wordpress support board. Just to make sure, what code have you copied to the widget?
Title: Re: CpmFetch php code not working in sidebar widget
Post by: Nymheria on May 31, 2016, 08:09:39 am
Alright thank you, should I post there : https://wordpress.org/support/forum/plugins-and-hacks ?

I have copied the second code :

<?php
  include "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  $objCpm->cpm_viewLastAddedMedia(1,4);
  $objCpm->cpm_close();
?>
Title: Re: CpmFetch php code not working in sidebar widget
Post by: Αndré on May 31, 2016, 09:30:25 am
I'm no CPMFetch expert, but the code looks correct. I don't know how Wordpress handles custom PHP code in their widget functionality, but something goes obviously wrong, as everything after the first ">" is displayed as plain text. It seems Wordpress interprets that digit as closing PHP tag.

Please try to add that code to a new PHP file somewhere on your webspace, to make sure it works as expected.
Title: Re: CpmFetch php code not working in sidebar widget
Post by: ron4mac on May 31, 2016, 01:25:02 pm
Here are a few links that will help you solve your problem:

https://wordpress.org/plugins/php-text-widget/
https://wordpress.org/plugins/php-code-widget/
https://wordpress.org/plugins/enable-shortcode-and-php-support-in-text-widget/
http://www.wpstuffs.com/how-to-execute-php-code-in-text-widget-without-using-plugin/
Title: Re: CpmFetch php code not working in sidebar widget
Post by: Nymheria on May 31, 2016, 04:30:30 pm
Thank you so much, I used one of the plugin and it works now !  ;D