the_permalink()
, the_title()
by default echo
their value. As you want to store that value in a variable you will need to return
the values instead.
get_the_permalink()
, get_the_title()
are two similar functions that return
the value instead of echo
.
So you new code may look something like this:
$list="<li class="ubermenu-submenu ubermenu-submenu-id-122-col-0 ubermenu-submenu-type-stack">";
$list .= '<a class="ubermenu-target ubermenu-target-with-icon ubermenu-item-layout-icon_left" href="';
$list .= get_the_permalink();
$list .= '" title="';
$list .= get_the_title();
$list .= '"><span class="ubermenu-target-title ubermenu-target-text">';
$list .= get_the_title();
$list .= '</span></a></li>';
Related Posts:
- Undefined Function Fatal Error with Shortcode [closed]
- Stop WordPress automatically adding tags to post content
- Update post counts (published, draft, unattached) in admin interface
- How to Display a List of Users Who Have Made at Least 1 Post?
- Find out who deleted a page or post?
- WordPress removing tags?
- WordPress: How to get the current logged in author page URL?
- disable password protected page for logged users
- Update all posts automatically when using post_meta
- Search & Remove Specific Shortcode From All Posts
- Force “Submit to review” when a post is updated
- Shortcode Not displayed at the Right Place [duplicate]
- Automatically added brs and paragraphs?
- Overview with latest edited posts and pages
- Specific loop in Shortcode
- Navigation link to specific user page
- Get how many days since last post of the current user
- Hide comments awaiting moderation from user who submitted the comments
- How to add shortcode tags in single.php [closed]
- Query All users that has post
- How To Add Perfect Apostrophe And Quotation Mark In WordPress Posts?
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- How to create shortcode to show the 2 latest posts
- Limit number of posts a user can make per minute?
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- wp_insert_post let users post to without login…broke
- Hide Post comments when displayed via WP_Query
- Get user’s most published categories
- Allow anonymous users to post to my site for moderation
- Remove Shortcode […] from Blog Preview
- disable column on post and user list
- Echo Text If User Is Logged in But NOT the Author of post
- WordPress 302 Redirect to Random Product/Post/Page
- Deleted a user with administrator rights. Now all the data/content/images are lost. how to recover them back
- Show number of posts by logged in user
- How to convert query sql to shortcode in wordpress?
- How can I add 2 buttons with shortcode
- Why aren’t paragraphs breaking on this page?
- Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
- HTML Inside of Shortcode Breaks Shortcode Output
- Cannot select certain authors for posts after import
- Shortcode for tables which can include comma and linebreaks
- post/page content
- How to limit post (Exception pages) for current user in each role in front end?
- Change published date and time using SQL query for page in every 5 hour
- What parameters do I need to pass to get_tags to get ALL tags for the site, when used in a post
- Shortcode for Comments and Comment Boxes in Post Loop
- get category in list of posts // shortcode for custom related posts
- shortcode // get posts by ids
- Display “no post” message
- How can I create a shortcode to show the number of posts of actual day?
- Featured Story Shortcode not outputting content
- Function is printing twice – any suggestions?
- How to pull sticky post permalink inside php?
- Contact Form 7 Shortcode not recognized inside another shortcode
- Display Post from Custom Post Type with Shortcode
- wp_insert_post() Add and specific ID to the body of that
- How can get the last post date of the user?
- Add a url parameter to the current post and read it in a shortcode
- Is there a way to save different data when USER interacts with the same POST?
- How to display particular categorie’s post which associated to specific user?
- WordPress Delete Users from backend doesn’t work
- Allow users to post their videos to my wordpress website?
- Secretly passing post ID/title etc into a shortcode form automatically to link submission to post
- I need show posts by customer (Shortcode)
- Is it possible to query a category with specified posts?
- Compare date of user’s last posts
- Shortcode: How to add custom posts?
- Add new post only in assigned category
- WordPress each user has each content for a page,how to do that?
- User rank in wordpress post
- Add category attribute to custom recent post shortcode
- Count how many posts a user has viewed
- Shortcode for printing post titles
- Allow users to create their own page/s
- Get current user array with post string
- How to use extract shortcode in loop?
- My posts section for logged in user
- Using Post ID and Page ID in same function
- Show Custom Post From Logged In Author
- Display only posts with comments
- Delete old post with new post
- Change the default video URL in a post to shortcode format
- How to handle dates, trying to calculate time since a post
- each user having category with their name and can add sub categories post in that category
- The post order is different for logged-in and non-logged-in users? [closed]
- How do I add an article to specific page?
- get value from post to sidebar
- WordPress Yoast SEO plugin Post Save/Update Issue
- If post has non-shortcode string
- Insert Shortcode exactly at the end of the content
- Trying to create shortcode listing custom posts, but formating not being included
- User submitted post
- Simple shortcode to check if a user has commented on a certain post
- Automatically select category based on user role
- How to use shortcode to get the second to newest post?
- How to allow Contributors to edit their own posts, whilst still needing to be reviewed by an admin?
- Allow users to edit post without logging in
- Does WordPress Super User or Administrators can create and edit post and media on behalf of a user
- How can I strip a single tag from an email post