get_comment_author_link not working properly

Simple solution drop this in your functions.php function your_get_comment_author_link () { global $comment; if ($comment->user_id == ‘0’) { if (!empty ($comment->comment_author_url)) { $url = $comment->comment_author_url; } else { $url=”#”; } } else { $url = get_author_posts_url($comment->user_id); } echo “<a href=\”” . $url . “\”>” .get_comment_author () . “</a>”; } If the user is registered this … Read more

Hiding Media Source Links

Link to none would only remove the hyperlink from the media. If the user clicks on the media, the media will not open separately in a window / tab. There is no way to hide the link to the resources. There is no security threat of accessing other files from external user.

How to show author page link

Have you tried something like: /*Get number of entries*/ function get_entries_num( $id ) { $count= count_user_posts( $id ); if ($count == 1) { return ‘<a href=”‘.get_author_posts_url($id).'”>’.sprintf(__(‘%s total post’,’upme’), $count).'</a>’; } else { return ‘<a href=”‘.get_author_posts_url($id).'”>’.sprintf(__(‘%s total posts’,’upme’), $count).'</a>’; } }

javascripts files not linking to my category slugs?

Relative URLs are best avoided in WP, so use absolute URLs instead. Also, you should load javascript files using the correct method, ie by using the wp_enqueue_script() function hooked to the wp_enqueue_scripts action hook. Doing both of these things will sort out your issue. Using wp_enqueue_script() will also allow you to define dependencies so, for … Read more

Adding custom url to readmore link using get_permalink()

I suspect the issue is that $recipe_url is undefined in the portion you’re trying to echo it. Can you post a link to the full code of recipe_options.php? Use pastebin or something. Try: href=”https://wordpress.stackexchange.com/questions/114230/<?php $recipe_detail_xml = get_post_meta($post->ID,”recipe_detail_xml’, true); $cp_recipe_xml = new DOMDocument (); $cp_recipe_xml->loadXML ( $recipe_detail_xml ); $recipe_url = find_xml_value($cp_recipe_xml->documentElement,’recipe_url’); echo $recipe_url ; ?>”

How to add class to anchor using wp_nav_menu

WordPress does in fact add a current class by default: check where it says: <li id=”menu-item-1688″ class=”current-menu-item”> Within your source code. Now as for the other item, this is a bit tricky. There is two ways to do it assuming that you need the last item for styling. Option #1 is with pure CSS using … Read more

Active class to current link

Edit Two things: wp_nav_menu() also outputs .current_page_item, as backward compatibility with wp_page_menu(). Among the list item CSS classes added by wp_nav_menu(), for a custom post type, list items will have a CSS class .list-type-object-{slug}, where {slug} is the CPT slug. So, you could target: .list-type-object-{slug}.current-list-item Original Answer The key is in the class name: .current_page_item. … Read more

Put password on a wordpress link in a article

I think this is almost what the article Add Private Content to Posts via Shortcode talks about. But it’s only for registered users: add_shortcode(‘private’, ‘private_content’); function private_content($atts, $content = null) { if ( is_user_logged_in() ) return ‘<div class=”private-content”>’ . $content . ‘</div>’; return ”; } And used inside the post/page like: [private] This post contains … Read more

Highlight current post type when inside custom post type

I am assuming that your code is on a “single” post/cpt page. echo ‘<ul>’; $loop = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 4, ‘order’=>’ASC’ ) ); $obj = get_queried_object(); $thispage = $obj->ID; while ( $loop->have_posts() ) : $loop->the_post(); ?> <li><?php if ($thispage === $post->ID) { $class=” class=”current-item””; } else { $class=””; } the_title( … Read more

Opening Menu link in another tab

When in the Appearance > Menus admin screen, click the Screen Options tab in the upper right corner, then under Show advanced menu properties tick the Link Target box. You’ll now have a check box for each menu item labeled Open link in a new window/tab. That said, many people these days do not take … Read more

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