WordPress.org

Forums

List category posts
Custom Fields in Templates? (27 posts)

  1. amycarolyn
    Member
    Posted 4 years ago #

    I happen to love this plugin. It's very handy. If I wanted to create a new template that would pull in three custom fields in addition to the other options, is that possible with this plugin? I would need to find someone to help me, but if it's not possible I won't even bother. I figured out how to pull custom fields into a category template, but would like to add them as an option using this plugin for the end user.

  2. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    Hi, I'll get to work on this feature for the next release, so when 0.15 comes out, look for this feature.

    It's been asked a lot, to use custom fields, so it's next on the to-do list :)

    Thanks for using the plugin!
    Regards

  3. amycarolyn
    Member
    Posted 4 years ago #

    Oooooooooh! That sounds great. Is this something that is coming soon, in a few months, year? Not trying to rush you, just curious. :)

  4. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    Sooner rather than later I would say. It's a matter of me getting the time to hack it into the plugin, so stay tuned!

  5. VixWP
    Member
    Posted 4 years ago #

    First, thank you for the awesome plugin. This is what I was looking for, for a while.

    Second, I'm looking for this same feature as well. It'll be very useful.

    Also, another one I was looking for is GroupBy option. Here's what I'm trying to achieve:

    1 - List of Posts
    2 - By Title
    3 - Ordered Alphabetically (ASC)

    I was able to achieve this all by your plugin... now, this is the extra I'm looking for:

    4 - Group the list by (in my case) Alphabet Letter, so the end result will be:

    Articles That Start with "A"
    ----------------------------
    - list of
    - Articles that
    - Start with
    - The Letter A

    Articles That Start with "B"
    ----------------------------
    - list of
    - Articles that
    - Start with
    - The Letter B

    Articles That Start with "C"
    ----------------------------
    - list of
    - Articles that
    - Start with
    - The Letter C

    etc.. etc..

    (To extend this further, maybe even have the code recognize this, and give the option to put the line "A - B - C - D- .. etc.." on the top of the page, which have an anchor link to that section in the page... but this is a nice to have as opposed to a must have)

    Let me know if you plugin can do this in the current version, or if this is something planned in future versions.

    Thanks

  6. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    amycarolyn the custom fields support has been added on version 0.15 of the plugin, so please check it out and test it!

    In case any problems arise, please let me know.

    VixWP I hadn't considered doing an alphabetical ordering of the posts. I guess this could be done by querying the posts that start with each letter, or adding some logic to group them with PHP once they're retrieved from the DB. But I think this would be pretty heavy, I would have to look deeper into it.

    Thanks for using the plugin, and please keep on posting feedback, ideas and requests!

    Regards

  7. VixWP
    Member
    Posted 4 years ago #

    Pardon my ignorance, but, not being a technical person, I am a little confused about the explanation of how to have the custom field show up .. I upgraded to the 0.15 version.

    You say: Added custom fields support. Define both custom field (customfield_name) and value (customfield_value) to use it.

    What that's doing is FILTERING the list, as opposed to displaying the customer field value

    So, here's what I'm trying to achieve. I want the screen to ultimately look like this:

    >> ABCDEFG - uvwxyz
    >> HIJKLMN - opqrst
    >> OPQRST - ijklmn
    ... etc...

    (Where "ABCDEFG", "HIJKLMN", "OPQRST" are my post titles, and the "uvwxyz", "opqrst", "ijklmn", etc are my post custom field values for customname: "subtitle")

    So I was hoping to be able to do something like this:
    [catlist id=3 orderby=title order=ASC numberposts=-1 customfield_to_display=subtitle]

    Which, what I would expect it to do is, since it knows the post ID, it looks for a customfield by the name of "subtitle", it would:
    - write the Post Title (as it does now) (ABCDEF)
    - put a SPACE DASH SPACE
    - write the VALUE that I've specified for the customfield "subtitle" (uvwxyz)

    So at the end, it'll look like:

    >> ABCDEF - uvwxyz

    VERY SIMILAR to how you have the post AUTHOR to show up. The only difference is, in a post, there's one author, but there may be multiple customfields. the parameter would have to add a filter. SO, by having the parameter "customfield_to_display=subtitle" , it's like saying "customfield_display=yes customfield_value=subtitle"

    (to be really fancy, in future versions you can have users be able to type multiple custom fields, seperated by comma, OR enclosed in Paranthesis ()... so a parameter like this would display the values of the customfields specified:

    [... customfield_to_display=(subtitle, color, size) ...]
    (Assuming for this exampled, "subtitle", "color", "size" are all customfield values). The result of this would be something like

    >> ABCDEF - uvwxyz - Red - XL

    (Now, if you want to be REALLY REALLY Fancy, then you can even include a feature where people can chose the Divider AND/OR Container to use, so your shortcode would be like:

    [... customfield_to_display=(subtitle, color, size) divider="," container="{","}" ...]

    (the container would have two elements, one for the start, and one for the end

    The result of this would be something like

    >> ABCDEF {uvwxyz, Red, XL}

    If there are no containers specified, then no container will be used, and only the DASH right after the POST-TITLE will be used:

    >> ABCDEF - uvwxyz, Red, XL

    Ok, I think I'm getting carried away at this point! :) Hope these give you some good ideas for the enhancement of your awesome plugin! :)

  8. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    VixWPI re read the whole thread now and really got the idea of what you were after. I'll work on this, it's a great idea to display the custom field's values. Sorry for misunderstanding!

    I'll get to work on it right now, so expect it for a future version! Guess 0.16 will include this already.

    Thanks for the awesome feedback. Regards!

  9. VixWP
    Member
    Posted 4 years ago #

    Anytime, buddy! it's a great plugin, and just trying to give my 2 cents ! :)

  10. amycarolyn
    Member
    Posted 4 years ago #

    Hey, thanks for working on this! I also wanted to display custom fields as opposed to filtering. Displaying the custom fields is great for posts that are job listings (category list would display title, company, location), or book listings (category list could display title, price, ISBN)... things like that.

    I've done this on the category pages using PHP within the loop, however your plugin is so useful for content managers to use and also for layouts that require more flexibility (no building a bunch of different templates for each page type).

    Thanks again!

  11. enricofra
    Member
    Posted 4 years ago #

    Hi Fernando,
    I've developed for a friend a small website, based on a theme from elegantthemes, and I used your list-category-post for image galleries.
    The galleries are list of posts with the setting "thumbnails=yes" set.
    With the last version (available at the beginnig of december) the galleries where perfect but I had a problem with the login screen which crashed. I had to disable your plugin everytime I wanted to login in the backoffice :)
    Last week I upgraded your plugin to the latest version and the login issue disappeared. On the other hand, the galleries are not working anymore: they show the post titles and not the thumbnails.
    What can I do to correct this? I'm not good at PHP otherwise I woul tried to spot the issue, but I haven't read of the problem anywhere and so I'm afraid it's something that depends from my template.
    The old plugin used to show as thumbnail images the images I put in the featured image field, the new version is like it doesn't see the thumbnail image at all.

    It's quite urgent, if you can help!! Thanks!
    Enrico

  12. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    VixWP & amycarolyn look out for the new feature on version 0.16 (about to be released).

    enricofra I'll check this out, might have changed something on the code that broke the code. I'll let you know.

    Thanks for using the plugin and big thanks for all your feedback!

  13. ortixia
    Member
    Posted 4 years ago #

    i have just updated to the latest version and my shortcodes are a little messed up.
    Is there some sort of protocol after/before updating (such as deactivating plugin while updating)?
    I admit i have nested my shortcodes. I hope this makes sense.
    ie. history page has a shortcode for posts for each year, and each year has a shortcode for all the posts of that year..
    None the less, on my 'history page' i do not see the second layer of shortcodes but rather (...)
    the page in question is http://www.terralingua.org/about-2/chronology/
    any thoughts on how i can fix this would be helpful.
    thanks.

  14. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    Hi ortixia,
    There's no protocol on updating, the problem is I did some fixes on shortcode nesting.

    The problem was, if you had a post on category 4 wich used say:
    [catlist id=4]
    Then you created another post wich included the previous post, so there would an infinite loop.

    I obviously messed up, didn't consider other loopings like your case...
    I'll fix it and release version 0.16.1 asap.

    Thanks for posting!

    Regards

  15. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    ortixia it's fixed on version 0.16.1. It should be available on your WordPress Dashboard in some minutes.

    Sorry about uploading this bug, and thanks for posting about your problem!

  16. ortixia
    Member
    Posted 4 years ago #

    Wow! thank you.
    I am very grateful for this plug-in as it is the only one I could find which does support a nested short-code.
    I am glad to be able to continue with this.

  17. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    I'm glad I could help!

    Version 0.16.1 is already available on WordPress.org, so it shouldn't be long before your dashboard tells you about the update. Please let me know if everything went back to normal.

    It's really important when users report issues, because I can't always test every possible option. So thanks again, and if there's any more bug reports, ideas or comments on the plugin, please don't hesitate to contact me on this forum.

    Regards

  18. VixWP
    Member
    Posted 4 years ago #

    You're the MAN!!! I already saw the update alert in the WP Admin Dashboard. Upgraded it. Can't wait for you to edit the documentation to know how the custom field stuff I described works!

    Thank you very much, Fernando. I'll report back with any successes or bugs

  19. ortixia
    Member
    Posted 4 years ago #

    it worked! wonderful! thank-you so much!

  20. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    VixWP check the README file for documentation on how to use the custom field feature.

    I think it's already updated on the WordPress site with version 0.16.1, but for some reason the site is sometimes not taking the README file changes to display.

    ortixia: Awesome! Glad to know! Let me know of any further comments or errors.

    Thanks for using the plugin and reporting any issues everybody!

  21. enricofra
    Member
    Posted 4 years ago #

    HI Fernando,
    I want to say that your help is precious and this is how real professional developer are, always ready to listen to their user and fast in solving issues! :) Thanks!

    In the meantime my problem has not been solved by the new release.
    I'll try to create a little background behind my issue.

    I've developed the website of an art painter. He's got hundreds of artworks which are collected in galleries. So I created one post for every artwork, with the artwork itself added as "Featured Image". Then I created one page for every gallery which consists of:
    - a text, which introduce to the concept behind the gallery
    - the thumbnails of the posts related artworks
    These thumbnails are provided by your plugin, which is called by this line:

    [catlist name=dreamcatchers orderby=rand numberposts=-1 thumbnails=yes]

    (I added "thumbnails=yes" in the last few days, trying to solve the issue I have. When I created the website, it was not present and thumbs where visible anyway)

    This is the page of one of the galleries:
    http://www.mondomultiplo.com/galleria/dreamcatchers

    The website is up since the beginning of december, and for the first month and a half everything was smooth. The only problem I had was that with your plugin installed I could not login in the wordpress admin pages, so I had to disable it through FTP every time I wanted to change something, and it was a little frustrating.

    Some days ago, 7, 10, I don't remember you published an upgrade which addressed just this login problem and I installed it immediately but, since then, the thumbnails disappeared.

    I tried everything I could, which is not much, and they didn't reappear.
    For instance:
    - I added the "thumbnails=yes" command, no change
    - I removed the artwork from the "featured image" and put it in the post, no change
    - I even tried to downgrade to older versions of the plugin and nothing changed again, which is very very weird. How is it possible?

    Do you have any idea on what I have to do to solve this?
    I'm sorry to press you but my client is quite upset and I don't know what to do.
    Thanks again for your precious help!
    Sincerely
    Enrico

  22. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    Enrico, I'm trying to figure out what could be going wrong with the plugin. As you described, it's pretty weird.

    The plugin uses the the get_the_post_thumbnail function this way:

    if ( has_post_thumbnail($single->ID) ) {
    		$lcp_thumbnail = get_the_post_thumbnail($single->ID);
    	}

    The documentation for the function says:

    Gets Post Thumbnail as set in post's or page's edit screen and returns an HTML image element representing a Post Thumbnail, if there is any, otherwise an empty string.

    Note: To enable Post Thumbnails, the current theme must include add_theme_support( 'post-thumbnails' ); in its functions.php file. See also Post Thumbnails.

    First thing you should do is make sure your theme has thumbnails enabled (even more info).

    I'm guessing the plugin used to display the images as part of the post, but I'm not sure how it used to do it, now it doesn't, and not even installing an older version.

    The other possibility I've been considering is using wp_get_attachment_image, which: returns an HTML image element representing an attachment file, if there is any, otherwise an empty string.

    Please, let me know about the thumbnail feature in your theme. We'll get to fix this one way or the other :D
    Thanks!

  23. enricofra
    Member
    Posted 4 years ago #

    Fernando, thanks again for your help... but we're not there yet ;)
    The thumbnails function is "alive and kicking" in functions.php.
    If you click on "artwork" in the menu you see it working.

    Meanwhile I've checked some fundamentals I've not yet tried like:
    - disabling every other plugin
    - repairing permissions
    - replace the theme files completely
    - replace the wordpress files completely

    No results yet.

    It's so incredibly weird. I'm in computers since commodore 64 and I know they are "moody" sometimes, but it's too much. I guess the reason is under my eyes and I cannot see it...

  24. fernandobt
    Member
    Plugin Author

    Posted 4 years ago #

    enricofra sorry I didn't notice this earlier...

    Try:
    thumbnail=yes
    instead of
    thumbnails=yes

    There was an update notice:

    == Upgrade Notice ==

    = 0.13.2 =
    Thumbnail parameter 'thumbnails' changed to 'thumbnail.

  25. Doe3
    Member
    Posted 4 years ago #

    I have the same problem. If I use thumbnail=yes no thumbnail is displayed, if I use thumbnail=yes the page where I use the shortcode is empty, not even the sidebar is showing. It's really weird.
    Any ideas?

  26. nowton
    Member
    Posted 3 years ago #

    Anyone mind sharing a code example of how to display custom fields? Readme and website are too vague imo. Thanks.

  27. Bill_Peschel
    Member
    Posted 3 years ago #

    I'm working on my new WP site, so I'll share what I know, Nowton.

    I've written a lot of book reviews, and in Expression Engine, I had custom fields set up so I could type in the book's title, the author, the Amazon link and a combined author/title.

    This allowed me to place the combined author/title at the top of the review, insert the Amazon link (which was the book cover and text) into the review, off to one side, and on a separate page create lists of books by title and author (the names had to be last name then first name, which is why it seems like I duplicated my effort.

    Here's the link to my book review page using EE coding. Amazon is retooling its links, so you might not see it (and eventually, the EE page will go away once the WP part of the site goes live).

    So, in porting my site over to WP, I'm trying to replicate that. I couldn't port over the custom fields (darn it), but I'm in the middle of figuring this out.

    With that out of the way, let me focus on one custom field and how it's being used in the TwentyTen theme.

    1. Created a Custom Field called "Bookinfo (Title. Author.)"

    2. In the Appearance Editor, opened loop.php

    3. In the section where it begins <div class="entry-content">, I inserted this on the next line:

    <b><?php echo get_post_meta($post->ID, 'Bookinfo (Title. Author.)', true); ?></b>

    This placed the value of that Custom Field after the Title but before the book review. <b></b> bolded that line.

    (I think I had to add the single quotes because I didn't use a simple value such as "basic", but I needed to remind myself how to format the information.)

    4. To have the custom field display that information on a single-post page, I repeated step 3 to loop-single.php.

    (Coders: Feel free to jump in and correct me.)

    Now for the List Category Post plugin, I've been trying to make it create a page in which each category's reviews are listed by the Custom Values of Booktitle.

    List Category Post creates links using the Title field, which I don't want. It lists the Custom Values, but also the name of that value,

    So, I created a page and typed this in:

    Comic Books
    [catlist id=35 numberposts=-1 customfield_display='Bookinfo (Title. Author.)']

    And this is what I get:

    Comic Books
    * Al Columbia’s high-octane nightmare fuel
    Bookinfo (Title. Author.) : Pim & Francie: The Golden Bear Days.

    I want to get ride of the asterisk and the title and turn the Custom Value into a link like this:

    Pim & Francie: The Golden Bear Days.

    I figured out how to remove the value's title. It's in CatList.php, where you replace

    $lcp_customs .= "<div class=\"lcp-customfield\">" . $something. " : " . $value . "</div>";

    with

    $lcp_customs .= "<div class=\"lcp-customfield\">" . $value . "</div>";

    But I haven't figured out how to turn my custom value into a link. Best I can tell, the answer is in CatListDisplayer, where these bits of code appear:

    private function get_custom_fields($custom_key, $post_id, $tag = null, $css_class = null){
            $info = $this->catlist->get_custom_fields($custom_key, $post_id);
            return $this->assign_style($info, $tag, $css_class);
        }
    
        private function get_post_title($single, $tag = null, $css_class = null){
            return '<a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
        }

    The link code (<a href=) is in the get_post_title function. My knowledge of PHP is on a par with open-heart surgery, so I've been moving code around, crashing the page, reloading the code -- you know, clip the blue wire and see if the bomb blows up, so any ideas will be gratefully appropriated.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic