Wraping $content into link with shortcodes

This is a filter in WordPress called wpautop it is there to make formatting cleaner when publising posts, however when you want more control over formatting it can be a pain. It basically wraps returns in paragraphs so that the space you see in the editor is obeyed on the front end. You can disable … Read more

widget to output a link to archive view

get_archive_link() is used to generate internal html links for output. If you want to link to archive page from single.php why dont you use get_post_type_archive_link here is an example of how you can use this. it takes only one parameter (post type) <a href=”https://wordpress.stackexchange.com/questions/368468/<?php echo get_post_type_archive_link(“movies’ ); ?>”>Movies Archive</a> //here movies is the post type

How to pre-fill Google Forms URLs with logged-in WordPress user’s data

AS easy as you said: $user = wp_get_current_user(); if(!empty($user)) { $email = $user->user_email; $fname = $user->user_firstname; $sname = $user->user_lastname; $url=”https://docs.google.com/forms/d/e/1FAIpQLSeChqhovV70FbILIlfeo8K5UL9q3hfjPkngEe4IJkXMmCbawg/viewform?entry.646601418=STUDENT+01&entry.280532864=”.$email.’&entry.1176284616=’.$fname.’&entry.165661554=’.$sname; echo $url; } else { $email=”[email protected]”; $url=”https://docs.google.com/forms/d/e/1FAIpQLSeChqhovV70FbILIlfeo8K5UL9q3hfjPkngEe4IJkXMmCbawg/viewform?entry.646601418=STUDENT+01&entry.280532864=”.$email.’&entry.1176284616=First&entry.165661554=Last’; echo $url; } If the user is logged in (if !empty ($user) ) then it grabs the data from the user variable wp_get_current_user, we could also wrap in … Read more

Change website URL without breaking links or images? WP 3.3

There is a helpful codex article about moving WordPress: http://codex.wordpress.org/Moving_WordPress. Basically, you need to find/replace the DB for instances of your old domain, and swap them with your new domain. One additional trick I’ve learned when moving WordPress between environments: since WordPress stores the domain in several places as serialized data in the DB, you … Read more

How to show Disqus comments and pingbacks?

The plugin you mentioned is only a single function so it shouldn’t be too heavy on your setup. It uses the comments_template filter to inject the pingbacks/trackbacks list into your page. But the plugin is using an extra manual SQL query and the template is constructed by hand, so there’s a room for improvements/simplifications. A … Read more

Get current users post URL?

Well if your code is working properly and the only problem is that it displays when no one is logged in then try the code below. Because right now you are saying “Hey WP just echo out this” – so it does it. You need to change it to: “Hey WP if the user is … Read more

How to attach Links into page/post or custom post type?

This is a simple and quick Metabox + jQuery + Plain Text solution. If you’d like to split the dropdown into categories, then check the documentation for get_bookmarks. This may also be useful: add_meta_box. This is the result: And the code: add_action( ‘add_meta_boxes’, ‘wpse_42440_add_custom_box’ ); add_action( ‘admin_head’, ‘wpse_42440_script_direct_print’ ); function wpse_42440_add_custom_box() { add_meta_box( ‘wpse_42440_sectionid’, __( … Read more

Get link value only from the_content()?

You can scan the content to see whether it contains a link and then parse it to find the href attribute. There are many ways to do this, this example uses the built-in kses functionality, as demonstrated by Otto: $post_link = get_the_permalink(); if ( preg_match(‘/<a (.+?)>/’, get_the_content(), $match) ) { $link = array(); foreach ( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)