Skip Navigation

[Resolved] Add a image and modify the name of dynamic source on the archive page

This support ticket is created 2 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2188855
archives-citations.png

Tell us what you are trying to do?

I do not know if I am expressing well but I am trying to modify in an "archive" page the name of the publication created after it has been sent by a member.
So I have a community website around books. I composed a relationship: hidden link between :
- the type of publication "Books": hidden link /wp-admin/admin.php?page=wpcf-edit-type&wpcf-post-type=livre
- and the type of publication "citation": hidden link -edit-type & wpcf-post-type = quote.

I allow from the "Citation" content model: hidden link to members to be able to publish quotes. The content model works flawlessly.

On the other hand, as soon as I am in the archive page: https: //crealecture.fr/wp-admin/post.php? Post = 3580 & action = edit, it doesn't work.

I want each quote to be referenced using the title and image of the book. I would like that by clicking on the title of the citation to go to the citations page for a book.
See example in the accompanying illustration. You should know that I have manually modified a title of a citation by giving it the name of the title of the book but I would like this to be done automatically.

In short, I want instead of Credxxxxxxxxx that we are the title of the book and that for each loop, we see the image of the book. How to do ?

Is there any documentation that you are following?
I don't know

Is there a similar example that we can see?
I don't know

What is the link to your site?
hidden link

#2189507

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I noticed that you've included the form to add a new "Citation" post ( "Ajouter une citation dans le modèle de contenu" ), on the single "Citations" post page ( through the content template "Modèle pour Citations" ). But, in the form, there is no field to select which parent "Livre" post this new "Citation" should link to.

Wouldn't it make more sense, if this form to add citation would be available on the single "Livre" post and not on the single "Citation" post?

regards,
Waqar

#2189539

Hello Waqar,
I intend to do it but does anything change anything to my question?

Regards
Frédérique Creton

#2189595

Re Waqar,
I added the "Livres-citations" search box and I get the image.
However, I still don't know how to change the name from Credxxxxxx to "Book Title".
Regards
Frédérique

#2189597
same-book.png

OK,
It's worse than I thought. I tested again and in fact now the system no longer associates citations with a book. As I understand it, he puts all the quotes for all the books. This is not what I want at all. I don't want quotes from a book to be added to a book's content model until they're on a separate page. I plan a lot of the type of publication associated with books and cannot fit everything into the book content model. I thought rather to put a kind of menu to link the book to the quote, the opinion, the created 1, the created 2, etc ...
Regards

#2189627

Re
I'm starting to have some. I'm sorry.
I have already informed you of this! But I have to move on!

You say it's no-code but on the other hand, it's slow! You can't do anything without a JSON error. You have a great tool, but it is almost unusable.
Short ! I think there is something to do with the Query. Should you put "Do not include the current page in the result of the query" or not? Then, at the level of the Query "publication relation or owner of groups of repeatable fields": what should you put?

Regards

#2189899

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

To pre-populate the title from the attached book, here are the steps that I followed:

1. In your form "Ajouter une citation dans le modèle de contenu", I included the post title field and in the default value added:
( screenshot: hidden link )


Citation from [wpv-post-title item='@livre-citation.parent']

As a result, the form's title field will automatically fill the title text, and [wpv-post-title item='@livre-citation.parent'] part will get the title from the parent "livre" post.
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-title )

2. Likewise, in the default value for the "Livres Citations" field, I passed the parent "livre" post's ID, using the shortcode:
( screenshot: hidden link )


[wpv-post-id item='@livre-citation.parent']

( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-id )

This way, the parent "livre" post is automatically selected in the "Pour quel livre souhaitez-vous ajouter une citation?" field too.
( screenshot: hidden link )

3. If you'd like to hide these 2 fields from visitors, so that they can't change the title or the parent "livre" post, you can include the following code in the form's CSS editor:


form[id^=cred_form_247_] .form-group:nth-of-type(1), form[id^=cred_form_247_] .form-group:nth-of-type(2) {
    display: none;
}

As for the errors in the browser's console and difficulty in editing the content in the blocks (Gutenberg) environment, I noticed they originate from this file from the "Yet Another Stars Rating" plugin:
{yourwebsite.com}/wp-content/plugins/yet-another-stars-rating-premium/admin/js/yasr-editor-screen.js

Can you please temporarily deactivate that plugin and then see if the editor experience improves?

#2190025

Re Waqar,
First of all, a very big thank you for your patience. I think your bosses told you to say "thank you for your post" when I think you were more inclined to tell me to fend for myself.
I wanted to apologize for talking to you like this. You are very efficient. Thanks for solving my title issue for the "quotes" archive.
Thank you also for telling me that I had a problem with the "YASR" plugin. This is not the first time that I have had problems with him. We will say that this time, I am lucky, he did not make me crash the site.
Short! However, JSON errors are still present. I don't know why. It blocks the functioning of the Query and the updating of the content (I mean it wrong but you must understand me I think). I'm about to figure out how to get the view to display quoted content from the same book.
Regards

#2190473

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your kind words and glad I could help.

I can understand that troubleshoot JSON errors can be frustrating and time-consuming. But, I'm confident that my recommendation from the other ticket will prove useful.
( ref: https://toolset.com/forums/topic/error-json/ )

At the moment it is not possible to edit the view inside the "Modèle pour Citations" content template due to the JSON errors. But, once this issue is resolved, you're welcome to let me know if you face any difficulty in showing the citation posts from the same parent book posts.

#2190571

Hi Waqar,
I am coming back to you because I have my second problem which comes to me. I am unable from a view to list all the citations for the same book. I tried with the Query filter "publication relationship or owner of groups of repeatable fields" with the condition "Publication where this view is displayed", the condition "Current publication in the loop" or even "details: quote" but nothing does not. Do I have to create a new ticket or can you reply in this ticket?
Regards

#2190693

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

For some reason, I can't edit or even see the settings for the view "Citations-livre" that you've placed in the content template "Modèle pour Citations".

It could be related to the JSON error issue that we're discussing in the other ticket. To show all "Citation" posts, which have the same parent "Livre" post, as the current "Citation" post, you'll need a classic/legacy view.

1. From WP Admin -> Toolset -> Views -> Add New (button), I created a new classic/legacy view "View to show Citations from parent livre":
{yourwebsite.com}/wp-admin/admin.php?page=views-editor&view_id=3808

2. In this view's settings, I selected to show all those "Citation" posts, which are related to the "Livre" post whose ID is passed in the shortcode attribute "wpvrelatedto".
( screenshot: hidden link )

3. For the Loop editor part of this view, I set it to load the content template "Loop item in View to show Citations from parent livre", which you can edit to show the single "Citation" post result, as desired:
{yourwebsite.com}/wp-admin/post.php?post=3809&action=edit

4. In the last step, I added this new view's shortcode, in the content template "Modèle pour Citations", so that the current "Citation" post's parent "Livre" post's ID ( [wpv-post-id item='@livre-citation.parent'] ) is passed in the shortcode attribute "wpvrelatedto":
( screenshot: hidden link )


[wpv-view name="view-to-show-citations-from-parent-livre" wpvrelatedto="[wpv-post-id item='@livre-citation.parent']"]

As a result, now all the "Citation" posts where the parent "Livre" post is the same, are showing on the single "Citation" pages. For example:
{yourwebsite.com}/citation/citation-pour-mon-amour/
( screenshot: hidden link )

#2190729

Sorry Waqar,
I found the origin of the JSON errors but it is related to the security of the website. While waiting to find a maintenance, security and backup plugin compatible with Toolset, I left the ones I currently use. I disabled them so you can go over them. Regards
Frederique Creton

#2190737
citation-actuelle.png

Re
It is very particular in operation, because on the page of a quotation, we do not see the "current" quotation but the other quotations for the same book.
Is it possible to see the current quote and more other quotes for the same book?

Regards

#2192817

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

To include the current quotation in the view's results too, you can uncheck the option for "Don't include current page in query result", in the view's settings.
( screenshot: hidden link )

#2192845

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.