Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Glad the plugin is useful to you. Donations keep things ticking.

    There are a lot of ways you could do the image thing here… here’s what I would do:

    1. Upload your 3 credit card images and take note of their IDs (you’ll see the attachment_id in the URL when you edit the image under the Media library menu, e.g. http://yoursite.com/wp-admin/media.php?attachment_id=123&action=edit

    2. Inside the CCTM, create a multi-select field and be sure to check the “Distinct options/values?” checkbox. You’ll want to list the Option as the name of the credit card and put the attachment ID as the Stored Value, e.g.

    * Visa 123
    * Master Card 124
    *American Express 125

    3. Choose the “gallery” output filter: that will convert one or many image ids (the attachment ids) to their images. (See docs here: http://code.google.com/p/wordpress-custom-content-type-manager/wiki/gallery_OutputFilter)

    You may need to download the dev version for this — there are a few bugs on the current version that are fixed on the dev branch.

    Thread Starter yesfree

    (@yesfree)

    Thanks for the fast reply i really appreciate it, It worked but it returns this error code at top of the image.

    Payment Methods:
    Warning: imagesx() expects parameter 1 to be resource, null given in C:\xampp\htdocs\mysite\wp-content\plugins\custom-content-type-manager\filters\gallery.php on line 62

    Warning: imagesy() expects parameter 1 to be resource, null given in C:\xampp\htdocs\mysite\wp-content\plugins\custom-content-type-manager\filters\gallery.php on line 63

    Hope its fixable please help me.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Sorry, you’ll have to play around with this yourself — if you don’t supply a value, the filter fails. It’s just basic lookup stuff. Sorry, I get emailed about this type of thing all. the. time. It’s 24/7 with no pay = bad investment. And I have almost no internet access and I’m swamped taking care of dying family members, so I can’t hold everybody’s hand. My life is an out of body experience right now, so you’ll have to forgive the brevity.

    Thread Starter yesfree

    (@yesfree)

    Thanks for your time and help and please don’t say its bad investment u will surely gain from it, It’s just a matter of time…and please i’m not good at coding so kindly tell me whats making that error appear, I know u can easily solve this for me, Thanks again.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    I apologize for snapping — yesterday was a bad day, and that wasn’t a good response for the forums. Watching someone fade away in hospice care is awful.

    Let me test the gallery bit here… you could do this without even using WP’s media library. You could upload 3 images and just input their names as your multi-select values, e.g.

    visa
    mc
    amx

    And then in your template you could do something simple with an if-statement or 2:

    <?php
    
    $my_cards = get_custom_field('cc:to_array');
    
    foreach ($my_cards as $cc) {
       if ($cc == 'visa') {
            print '<img src="full/url/to/visa.png" />';
       }
       elseif ($cc == 'mc') {
            print '<img src="full/url/to/mc.png" />';
       }
       elseif ($cc == 'amx') {
            print '<img src="full/url/to/amx.png" />';
       }
    
    }
    ?>

    That’s easier to follow, I think.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Custom Content Type Manager] Multi-select Image’ is closed to new replies.