Skip Navigation

[Resolved] How to insert a VIEW Link on the CUSTOM POST Loop

This support ticket is created 7 years 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 12 replies, has 2 voices.

Last updated by theW 7 years ago.

Assisted by: Beda.

Author
Posts
#582817
VIEW LINK.png

FOLLOW UP FROM
https://toolset.com/forums/topic/adding-an-edit-link-on-a-post-list/

Tell us what you are trying to do?

I would like to add a VIEW Link on the CUSTOM POST Loop.
Or
How to make the CUSTOM POST Title redirect to the VIEW Template when clicked

Is there any documentation that you are following?

Yes, but it does NOT mention the VIEW Link, only the "Edit" and "Delete" links.
https://toolset.com/documentation/user-guides/cred-training-course/part-9-listing-items-belong-logged-user/

Is there a similar example that we can see?

Please see my updated screenshot attached and visit
hidden link
(Only Members can log in and see)

What is the link to your site?
hidden link
(Only Members can log in and see)

#582930

I think what you want is a Link to the Single Post.
That is done by using the ShortCode wpv-post-link:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-link

Or, a combination of wpv-post-title and some HTML + the wpv-post-slug

See, in Toolset you will be able to create Links around almost everything if you construct the Link with HTML and populate it with ShortCodes:

<a href="[Any value ShortCode]" >[Any Label ShortCode]</a>

This will allow you to create a link to the single Post

#583149
Loop.png

Thank you very much for your reply beda.

I already have inserted that ShortCode as the tutorial suggested.

The problem is that, when that link get's clicked in the loop, It shows the Custom Post as editable with the CREED form again.
That is not what I need on this link because I also have another link called: "Update Project" which does just that.

What I need is a VIEW link , meaning when it gets clicked, the single custom post should appear but in a non-editable manner.
The content should be rendered as determined by the VIEWS Plugin.

Could I please send you some login details to show you?
It's a bit hard to explain.

Please see full code bellow:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ul class="wpv-loop js-wpv-loop">
<wpv-loop>

  • [wpv-post-featured-image]
    <H4>[wpv-post-link]</H4>
    Created on: [wpv-post-date]<br>
    Current Status: [wpv-post-status]<br>
    [wpv-post-comments-number]<br>
    [toolset-edit-post-link layout_slug="update-project"]Update Project[/toolset-edit-post-link]   [cred_delete_post_link class='cred-refresh-after-delete' text='Delete' message='Are you sure you want to delete this project?' message_after='Project deleted' message_show='1' action='trash']
    [themify_hr color="#73af00" width="100%" border_width="10px"]

  • </wpv-loop>

    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
    [wpml-string context="wpv-views"]No items found[/wpml-string]
    [/wpv-no-items-found]
    [wpv-layout-end]

    #583916

    [toolset-edit-post-link] will always generate a Link to either a Content Template or Layout, where usually only the CRED Form is inserted, but of course that depends on what you add to those Content Templates or Layouts.

    When you need to call the Post to only view it, you need to call the single Post URL.
    If that Single Post is displayed thru a Content Template it will display everything you add there.
    So if there is a CRED form in there, it will display too.

    If there is no CRED Form, there will be none in the Front End either.
    Generally you can call the single Post URL (permalink) with [wpv-post-link] or [wpv-post-slug] (depends if you want a clickable link or just the Slug).

    In your loop it is this part:

    <H4>[wpv-post-link]</H4>
    

    That will link to the single post.
    When you click there and see the post AND a CRED form it means, that this Post Body, or the Content Template in charge to display it, or the Layout in charge to display it, is also displaying a CRED Form.
    Please remove that CRED Form from there, if this is the case.

    I activated a private reply so you can add login informations, in case the issue is not clear yet.

    Please in that case also confirm the issues happen with Toolset Plugins alone and a native WordPress Theme.
    Please also add Links to where I can see the issues.

    Thank you.

    #584742

    The View Link is nothing else than the Post Link.
    I crafted a Custom HTML Link for you using intelligent positioning of our ShortCodes and HTML:

    VIEW: <a href="[wpv-bloginfo show='url']/[wpv-post-type]/[wpv-post-slug]">View</a>
    

    This will lead to the single Post as it's seen by any user when he/she visits this post.

    The problem is your posts (projects) have a Layout applied that holds only a CRED form.
    Hence, no matter from where you will visit your Posts or who will visit them, they'll always see the CRED form.

    Please proceed as this:

    1. Create a Layout "CRED EDIT PROJECTS"
    2. Insert the CRED Form to edit the Projects
    3. Link to this Layout with your edit link:

    EDIT: [toolset-edit-post-link layout_slug="update-project"]Update Project[/toolset-edit-post-link]
    

    (Update the code above to call the new Layout)
    ==> Do not assign this Layout to any content at all.
    4. Create a Layout that displays your Projects. No CRED Form here. Just Post things. Title, Post body, etc.
    ==> Assign this Layout to your Projects posts
    5. Link to this with my above crafted View Link.

    That should solve the problems.

    Thank you for the patience.

    #584883
    1.png
    2.png
    3.png

    Oh wow, it is working now!
    Thank you ever so much Beda! ...

    I follow your instructions and achieved the results but...
    For some reason after doing this changes, a few errors appear.
    Could you please help me figure out what I did wrong?

    ON THE CRED FORM:

    Warning: Creating default object from empty value in /home3/dlhg/projects.goodstewardservicing.com/wp-content/plugins/cred-frontend-editor/application/models/form/data.php on line 56

    Pictures
    There is a problem with gallery field. Please check CRED form.

    Video
    There is a problem with video field. Please check CRED form.

    hidden link

    ON THE VIEWS TEMPLATE:

    For some reason, the Views short code for the "Files" fields seams to be merging the URL values together, instead of displaying one icon per each repeatable URL value:
    hidden link

    #584899
    4.png

    ... ooops, found another error..

    (This is my second reply, please see my first reply above) ...

    I just created a new project on:
    hidden link

    After saving it, the new project display in the loop
    hidden link

    But the links have the same problem.

    Please see screenshot attached.

    Thank you!

    #584920

    Oh!... one detail to notice..
    (This is my third reply, please see my first and second reply above) ...

    I found out that when creating a New Project from the BACK admin, the links work perfectly!
    BUT when creating a New Project from the FRONT:
    hidden link
    The links have the same problem we've been dealing with.

    See the difference in links between:
    Test Project 1 (Created in the Front)
    Test Project 2 (Created in the Back)
    hidden link

    #584935
    1.png
    5.png
    51.png

    I'm so sorry for keeping on writing so much in this tread...
    (This is my 4th reply, please disregard all my replies above) ...

    Thankfully, It seems I was able to resolve a few issues myself, and left with only a few..

    ON THE CRED FORM:
    (Whenever "Updating a Project")
    This is the error that appears:
    "Warning: Creating default object from empty value in /home3/dlhg/projects.goodstewardservicing.com/wp-content/plugins/cred-frontend-editor/application/models/form/data.php on line 56"

    For the next error, I believe it must be a different topic so I would happily create another support ticket.
    Is there a way that I can assign you specifically so won't have to explain my self again to the other support member?

    This is the error:

    ON THE VIEWS TEMPLATE:

    For some reason, the Views short code for the "Files" fields seems to be merging the URL values together, instead of displaying one icon per each repeatable URL value:
    hidden link

    Thanks again!

    #585083

    The PHP warning is known to us and I already pushed for a Fix ASAP.

    I will set this ticket to "Escalated to second Tier" for this purpose.

    Yes the second issue needs a new ticket.
    Please submit one, with the access details attached and all links to where and how we can see the problem.

    I you cannot choose me from the preferred supporters just mention it, so anyone can re-assign this to me.

    Looking forward to solve that one too 🙂

    #585497

    Thank you Beda,
    Hope we can solve that error soon. I would love to learn about it, perhaps it's an error I caused and would like to avoid it in the future.

    I have created a new ticket here:
    https://toolset.com/forums/topic/file-field-not-displaying-repeatedly/

    Thanks a million!

    #585708

    This is solved in the latest stable releases.

    Please note that any erratum which you applied and still figures as open, will need to be applied again.

    Thank you for the patience.

    #586083

    Thank you. The error disappeared!