pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Featured image for a pod is shown twice #5633

Closed bryanhiggs closed 4 years ago

bryanhiggs commented 4 years ago

Describe the bug I have a Pod, "UUCM Services". I decided to add a Featured Image to my Pod instance, so I went in to edit the Pod, clicked on the Advanced Options tab, and enabled the Supports: featured image. Sure enough, when I went in to edit the UUCM service instance, I saw the Featured Image metabox, and added a featured image to that service.

I show these services on a page, https://uucm.org/ministries/upcoming-worship-services/, which is populated by a Pods query:

[pods name="services" template="UUCM Service Template" orderby="service_date" where="CAST(service_date.meta_value as DATE) BETWEEN CURDATE() and '2099-01-01'"]

FWIW, this page uses Elementor, and I'm using a Shortcode block.

The "UUCM Service Template" is as follows:

{@post_title}

[if from_date] through [else] [/if]

{@speakers}

{@post_content}

{@online_service_information}


Note the second line that is commented out. In this case, the service is displayed on the Upcoming Services page with no featured image. When I uncomment this line, the featured image is displayed as I would expect.

However, some time later, when I go back to that page, it shows two featured images, one above the title, and one immediately below it.

Currently, I am looking at it, and it is showing the single featured image before the title; I will go back later to see if the strange doubling behavior returns. Of course, as I'm reporting this, I'm not seeing it, on my PC, but it has happened at least twice.

Update: I now look at that page on my Android mobile phone, and I do see the two images. Actually, it shows the featured image, a title "Mud Seasons of the Heart (Online)", then the featured image again, followed by the same title in a smaller font.

Pods Version

Version 2.7.16.2

WordPress Environment

version 5.3.2

`

wp-core

version: 5.3.2 site_language: en_US user_language: en_US timezone: +00:00 permalink: /%postname%/ https_status: true user_registration: 1 default_comment_status: closed multisite: false user_count: 271 dotorg_communication: true

wp-paths-sizes

wordpress_path: /home/uucm_admin/uucm.org wordpress_size: 637.03 MB (667977857 bytes) uploads_path: /home/uucm_admin/uucm.org/wp-content/uploads uploads_size: 2.51 GB (2694680257 bytes) themes_path: /home/uucm_admin/uucm.org/wp-content/themes themes_size: 14.17 MB (14855450 bytes) plugins_path: /home/uucm_admin/uucm.org/wp-content/plugins plugins_size: 179.72 MB (188452230 bytes) database_size: 35.22 MB (36935279 bytes) total_size: 3.36 GB (3602901073 bytes)

wp-active-theme

name: OceanWP (oceanwp) version: 1.8.0 author: Nick author_website: https://oceanwp.org/about-me/ parent_theme: none theme_features: menus, post-formats, title-tag, automatic-feed-links, post-thumbnails, custom-header, custom-logo, html5, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, editor-style, customize-selective-refresh-widgets, align-wide, wp-block-styles, responsive-embeds, editor-styles, widgets theme_path: /home/uucm_admin/uucm.org/wp-content/themes/oceanwp

wp-themes-inactive (1)

Twenty Twenty: version: 1.1, author: the WordPress team

wp-plugins-active (53)

Add From Server: version: 3.3.3, author: Dion Hulse Advanced Gutenberg Blocks: version: 1.9.5.1, author: maximebj Akismet Anti-Spam: version: 4.1.4, author: Automattic Antispam Bee: version: 2.9.1, author: pluginkollektiv Auto Update Plugins: version: 0.1.4, author: Geenyous Limited Better Font Awesome: version: 1.7.1, author: Mickey Kay Black Studio TinyMCE Widget: version: 2.6.9, author: Black Studio Broken Link Checker: version: 1.11.12, author: WPMU DEV Classic Editor: version: 1.5, author: WordPress Contributors Code Snippets: version: 2.14.0, author: Code Snippets Pro Contact Form 7: version: 5.1.7, author: Takayuki Miyoshi Contact Form 7 Style: version: 3.1.8, author: Johnny, dorumarginean, mlehelsz, MirceaR Custom Menu Wizard: version: 3.3.1, author: Roger Barrett Duplicate Page: version: 4.2, author: mndpsingh287 Easy Google Fonts: version: 1.4.4, author: Titanium Themes Easy Table of Contents: version: 2.0.4, author: Steven A. Zahm Elementor: version: 2.9.7, author: Elementor.com Essential Addons for Elementor: version: 3.9.1, author: WPDeveloper Google Analytics Dashboard for WP (GADWP): version: 6.0.2, author: ExactMetrics Gutenberg: version: 7.8.0, author: Gutenberg Team Howdy Tweaks: version: 2.3, author: Kailey Lampert Jetpack by WordPress.com: version: 8.3, author: Automattic Kadence Blocks - Gutenberg Page Builder Toolkit: version: 1.7.18, author: Kadence WP Members: version: 2.2.0, author: Justin Tadlock My Custom Functions: version: 4.42, author: Space X-Chimp myStickymenu: version: 2.3.8, author: Premio Nav Menu Roles: version: 1.10.1, author: Kathy Darling Ocean Custom Sidebar: version: 1.0.5, author: OceanWP Ocean Extra: version: 1.6.1, author: OceanWP Page Links To: version: 3.3.3, author: Mark Jaquith Pods - Custom Content Types and Fields: version: 2.7.16.2, author: Pods Framework Team Popup Maker: version: 1.9.2, author: Popup Maker Private Google Calendars: version: 20200209, author: Michiel van Eerd Profile Builder - Email Confirmation Field: version: 1.0.4, author: Cozmoslabs, Adrian Spiac Profile Builder - Numbers and Phone Validation: version: 1.0.1, author: Cozmoslabs, Cristian Antohe Profile Builder Pro: version: 3.1.4, author: Cozmoslabs Relevanssi: version: 4.7.1, author: Mikko Saari Search Exclude: version: 1.2.5, author: Roman Pronskiy Simple History: version: 2.33.2, author: Pär Thernström SSL Insecure Content Fixer: version: 2.7.2, author: WebAware Tela Albums: Google Photo Albums for Wordpress: version: 1.5.2.8, author: Isaac Brown Timeline Express: version: 1.8.0, author: Code Parrots TinyMCE Advanced: version: 5.3.0, author: Andrew Ozz Title Remover: version: 1.2.1, author: WPGurus Visual Form Builder: version: 3.0.1, author: Matthew Muro WordPress Importer: version: 0.7, author: wordpressdotorg WP-VR-view - Photo Sphere and 360 video: version: 1.6, author: Tumanov Alexander WP Floating Menu: version: 1.2.9, author: AccessPress Themes WP FullCalendar: version: 1.2, author: Marcus Sykes WP Mail SMTP: version: 1.9.0, author: WPForms WP Media Category Management: version: 1.9.5, author: DeBAAT wp-mcm@de-baat.nl WP UI - Tabs, accordions and more.: version: 0.8.8, author: Kavin Yoast SEO: version: 13.3, author: Team Yoast

wp-plugins-inactive (2)

ShareThis Share Buttons: version: 1.3.0, author: ShareThis Velvet Blues Update URLs: version: 3.2.9, author: VelvetBlues.com

wp-media

image_editor: WP_Image_Editor_Imagick imagick_module_version: 1673 imagemagick_version: ImageMagick 6.8.9-9 Q16 x86_64 2018-12-14 http://www.imagemagick.org imagick_limits: imagick::RESOURCETYPE_AREA: 252 GB imagick::RESOURCETYPE_DISK: -1 imagick::RESOURCETYPE_FILE: 6000 imagick::RESOURCETYPE_MAP: 252 GB imagick::RESOURCETYPE_MEMORY: 126 GB imagick::RESOURCETYPE_THREAD: 1 gd_version: bundled (2.1.0 compatible) ghostscript_version: 9.10

wp-server

server_architecture: Linux 3.14.52-vs2.3.6.15-1 x86_64 httpd_software: Apache php_version: 7.3.15 64bit php_sapi: cgi-fcgi max_input_variables: 1000 time_limit: 30 memory_limit: 256M max_input_time: -1 upload_max_size: 64M php_post_max_size: 65M curl_version: 7.35.0 OpenSSL/1.0.1f suhosin: false imagick_availability: true htaccess_extra_rules: true

wp-database

extension: mysqli server_version: 5.7.28-log client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $

wp-constants

WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /home/uucm_admin/uucm.org/wp-content WP_PLUGIN_DIR: /home/uucm_admin/uucm.org/wp-content/plugins WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined

wp-filesystem

wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable

jetpack

site_id: 121430189 ssl_cert: No time_diff: undefined version_option: 8.3:1583266434 old_version: 8.2.3:1582315665 public: Public master_user: #2 Bryan (bryanhiggs@gmail.com) current_user: #2 Bryan (bryanhiggs@gmail.com) tokens_set: Blog User blog_token: t3yOQ$j6h1Z%y)2lpZW@4Ih4w9H37Q$u user_token: 5mPaE%BVqE4FejWG&63lDohcoXnV@XJ9 version: 8.3 jp_plugin_dir: /home/uucm_admin/uucm.org/wp-content/plugins/jetpack/ plan: free HTTP_HOST: uucm.org SERVER_PORT: 443 HTTPS: on REMOTE_ADDR: 75.67.250.149 protect_header: {"trusted_header":"REMOTE_ADDR","segments":1,"reverse":false} full_sync: {"started":"Thu, 01 Jan 1970 00:00:00 +0000","finished":"Thu, 01 Jan 1970 00:00:00 +0000","progress":[],"config":[]} sync_size: undefined sync_lag: 0 seconds full_sync_size: undefined full_sync_lag: 0 seconds idc_urls: {"home":"https:\/\/uucm.org","siteurl":"https:\/\/uucm.org","WP_HOME":"","WP_SITEURL":""} idc_error_option: false idc_optin: true cxn_tests: All Pass.

wp_mail_smtp

version: 1.9.0 license_key_type: lite debug: No debug notices found.

pods

pods-server-software: Apache pods-user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36 pods-session-save-path: /tmp pods-session-save-path-exists: Yes pods-session-save-path-writable: Yes pods-session-max-lifetime: 1440 pods-opcode-cache-apc: No pods-opcode-cache-memcached: No pods-opcode-cache-opcache: Yes pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: No pods-object-cache-memcached: Yes pods-object-cache-redis: No pods-memory-current-usage: 20.586M pods-memory-current-usage-real: 6.000M pods-network-wide: No pods-install-location: /home/uucm_admin/uucm.org/wp-content/plugins/pods/ pods-developer: No pods-tableless-mode: No pods-light-mode: No pods-strict: No pods-allow-deprecated: Yes pods-api-cache: Yes pods-shortcode-allow-evaluate-tags: No

`

Pods Package Export (helpful!)


I tried following the above directions, but it didn't seem to work.
bryanhiggs commented 4 years ago

I'm not sure the UUCM Service Template contents came through in the above. Here they are again:

<div class="service">
    {@post_thumbnail.large}
    <h2 class="title" style="margin-top:10px;">{@post_title}</h2>
    <p class="time">
        [if from_date]
        <time>{@from_date}</time> <em>through</em> <time>{@service_date}</time>
        [else]
        <time>{@service_date} {@service_time}</time>
        [/if]
    </p>
    <p class="speakers">{@speakers}</p>
    <p class="content">{@post_content}</p>

    <p class="online-details">{@online_service_information}</p>

    <hr />
</div>
JoryHogeveen commented 4 years ago

Hello @bryanhiggs

Assuming all other tags are working fine, are you sure the large image size exists for this particular image?

bryanhiggs commented 4 years ago

Well, I'm not sure how that's relevant. I am using the POD reference @post_thumbnail.large, and it shows the image. If there wasn't a large image, why would it show an image at all? And why would it sometimes show two images? (But, see below for my new "understanding"

How do I find out whether there is a large image size for that image?

FYI, I have now added a new service on our site "Navigating Hard Times", and given it a featured image. I have also added a second service "[TBA]", without a featured image. If you look at them both on the page https://uucm.org/ministries/upcoming-worship-services/, They look as I expected.

However, when I look at them individually, using the 'View UUCM Service" (from the Edit Pod page), or simply following the link supplied by {@guid} (which I use on the Our Next Service section title on the home page, https://uucm.org/), they look like this:

https://uucm.org/services/navigating-hard-times/ and https://uucm.org/services/tbs/

Both of them gain an extra header, followed by an


. The one with the featured image shows an image above the added header, and one above the second header. I am assuming that the top image and first header come from the default display of a post -- I assume the pod is just a custom post at that point.

So, I think I now understand what may be happening. My conundrum is how to cause only one featured image to display in both cases. Currently, if I supply a featured image, I get two on the post page ( {@guid} ), and one on the page generated by the PODS query. If I don't supply a featured image, I get zero featured images displayed -- totally expected.


Dr. Bryan J. Higgs 13 Quarry Circle Milford, NH 03055 U.S.A.

Tel: 603-673-7601 ‎"A nation's greatness is measured by how it treats its weakest members." ~ Mahatma Ghandi

On Tue, Mar 31, 2020 at 3:43 PM Jory Hogeveen notifications@github.com wrote:

Hello @bryanhiggs https://github.com/bryanhiggs

Assuming all other tags are working fine, are you sure the large image size exists for this particular image?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pods-framework/pods/issues/5633#issuecomment-606834409, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECWYKPYF4NJ73WZD5BESTRKJBULANCNFSM4LUOR3HA .

JoryHogeveen commented 4 years ago

Hi @bryanhiggs

Check, sorry I misunderstood the issue.

The template is working fine. The problem is that your theme already loads the featured image on the singular pages so there is no need for it to be added in your template. The singular and archive templates should be different in this case.

Also, {@guid} is not to be used for links at any time. This property is only for usage in WordPress RSS. Please use {@permalink}.

Cheers, Jory

bryanhiggs commented 4 years ago

Jory --

You closed the bug, but you never answered my question. Could you at least make a suggestion on how to solve this problem?

FWIW, I changed to using {@permalink}. It made no difference to the problem.

Regards

Bryan


Dr. Bryan J. Higgs 13 Quarry Circle Milford, NH 03055 U.S.A.

Tel: 603-673-7601 ‎"A nation's greatness is measured by how it treats its weakest members." ~ Mahatma Ghandi

On Wed, Apr 1, 2020 at 6:42 AM Jory Hogeveen notifications@github.com wrote:

Hi @bryanhiggs https://github.com/bryanhiggs

Check, sorry I misunderstood the issue.

The template is working fine. The problem is that your theme already loads the featured image on the singular pages so there is no need for it to be added in your template. The singular and archive templates should be different in this case.

Also, {@guid} is not to be used for links at any time. This property is only for usage in WordPress RSS. Please use {@permalink}.

Cheers, Jory

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pods-framework/pods/issues/5633#issuecomment-607174244, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECWYPQSAWNOZBO5M4YQVDRKMLBNANCNFSM4LUOR3HA .

bryanhiggs commented 4 years ago

Jory --

I also don't understand your comment about singular vs archive templates.

You say that my theme (OceanWP) already loads the featured image to the singular pages. So far, so good. But I'm using a PODS query to populate a page with future UUCM Services, and use a PODS template to display each of those UUCM Services. If I don't add the line in this template that specifically inserts the featured image, I get no featured image shown. Which is why I added that featured image element in the template.

But that immediately produces two featured images in what you seem to be calling the singular page.

You say that my singular and archive templates should be different. To my knowledge, I'm not using archived posts (unless it's somehow automatic). I'm using two PODS templates: one to display the individual UUCM Services on the Upcoming Worship Services page, and one to control the display of the section of the home page that gives a summary of the next upcoming services, and provides a link to display it more detail. If I could figure out how to point my "Our Next Service" section to a display of the corresponding UUCM Service that conforms to the way it is displayed in the Upcoming Worship Services page.

So how do I produce a template that will display my 'singular' PODS item without doubling up on the featured image?

This, above, is the question you never answered.

Regards

Bryan


Dr. Bryan J. Higgs 13 Quarry Circle Milford, NH 03055 U.S.A.

Tel: 603-673-7601 ‎"A nation's greatness is measured by how it treats its weakest members." ~ Mahatma Ghandi

On Wed, Apr 1, 2020 at 12:06 PM Bryan Higgs bryanhiggs@gmail.com wrote:

Jory --

You closed the bug, but you never answered my question. Could you at least make a suggestion on how to solve this problem?

FWIW, I changed to using {@permalink}. It made no difference to the problem.

Regards

Bryan


Dr. Bryan J. Higgs 13 Quarry Circle Milford, NH 03055 U.S.A.

Tel: 603-673-7601 ‎"A nation's greatness is measured by how it treats its weakest members." ~ Mahatma Ghandi

On Wed, Apr 1, 2020 at 6:42 AM Jory Hogeveen notifications@github.com wrote:

Hi @bryanhiggs https://github.com/bryanhiggs

Check, sorry I misunderstood the issue.

The template is working fine. The problem is that your theme already loads the featured image on the singular pages so there is no need for it to be added in your template. The singular and archive templates should be different in this case.

Also, {@guid} is not to be used for links at any time. This property is only for usage in WordPress RSS. Please use {@permalink}.

Cheers, Jory

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pods-framework/pods/issues/5633#issuecomment-607174244, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECWYPQSAWNOZBO5M4YQVDRKMLBNANCNFSM4LUOR3HA .

JoryHogeveen commented 4 years ago

To my knowledge I did answer that part:

In the Pod auto-template settings you can select a different template for archives and single pages.

The single page template should not include the featured image. This template is only used for the singular page. Any shortcode you use for making archives anywhere in your website should use the archive template which does include the featured image.

Alternatively, if your theme has such an option, simply disable the featured image for singular pages in your theme and just let Pods handle that.

JoryHogeveen commented 4 years ago

FWIW, I changed to using {@permalink}. It made no difference to the problem.

I know, it's unrelated to this problem. I just thought I'd mention this as the usage of guid is wrong :)

JoryHogeveen commented 4 years ago

I'm not using archived posts (unless it's somehow automatic).

I think there is a simple terminology issue here. Single / Singular = Individual (direct) pages for one single post, hence the name single. Archives = Taxonomies, blog overviews etc. Not to be confused with "archived posts".

This is simply how WordPress named such pages.

bryanhiggs commented 4 years ago

Well, I think I have it figured out. I learned about the Pods Frontier Auto Template plugin, so I installed it (after having a tricky time finding it), and then went into the Auto Template Options for the POD, and chose a different template from the UUCM Services Template, for the Single item view template (one that I had created, with the exact same contents as the UUCM Services Template, but without the featured image line.

Now, all seems to be correct.

Thanks for your help and patience.

I'd like to suggest that the PODS documentation on Auto Template Options be augmented, so that others could learn more easily. Thanks!

Regards, Bryan

Stay safe, practice physical separation, and wash your hands frequently!

JoryHogeveen commented 4 years ago

Hi @bryanhiggs Auto Templates are part of Pods core, no need for an extra plugin. It's a component called "Templates".

As for documentation: Have you checked our introduction video? All you need to know is in there. Might be a good idea to watch that! https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/