Adding nofollow to a PHP generated Nav
A simple str_replace would do the trick: $links = paginate_links( $arguments ); $links = str_replace( ‘href=”‘, ‘rel=”nofollow” href=”‘, $links ); echo $links;
A simple str_replace would do the trick: $links = paginate_links( $arguments ); $links = str_replace( ‘href=”‘, ‘rel=”nofollow” href=”‘, $links ); echo $links;
If the function returns a printed value: <a href=”https://wordpress.stackexchange.com/questions/145222/<?php bloginfo(“url’); ?>”>Link</a> If not (using the echo statement): <a href=”https://wordpress.stackexchange.com/questions/145222/<?php echo get_stylesheet_directory_uri(); ?>”>Link</a> You can also use print() as part of a more complex expression where echo cannot. By the contrary, when you want to use HTML into PHP, I recommend to close PHP and open … Read more
You’re firing a request to a PHP file that won’t have the WordPress library loaded – hence the undefined function error. You could manually load in WordPress with something like require ‘../../../wp-load.php’. Or, better yet, use the awesome AJAX API. Just fire your request to wp-admin/admin-ajax.php and then register a callback in your plugin or … Read more
The problem is that you forgot a apostrophe after ‘jquery-qtip-min) wp_register_script( ‘tooltip’, get_stylesheet_directory_uri() . ‘/qtip-js/tooltip.js’, array(‘jquery’, ‘imagesloaded’, ‘jquery-qtip-min), false, true ); should be wp_register_script( ‘tooltip’, get_stylesheet_directory_uri() . ‘/qtip-js/tooltip.js’, array(‘jquery’, ‘imagesloaded’, ‘jquery-qtip-min’), false, true ); I know that sometimes you can look over such things, especially if (maybe) you aren’t an experienced coder, but still please … Read more
You need to hook into some action that happens after the global $menu has been set. as an example: class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; } add_action( ‘admin_menu’, array( $this, ‘getWPdefaultmenus’ ) ); }
either use global variable in functions.php: global $prevPost; $prevPost = 10; in single.php : global $prevPost; if($prevPost) .. . . . Your code continues. . Second method: define a function in functions.php and call that in single.php in functions.php : function func_prevPost(){ $prevPost = 10; return $prevPost; } in single.php : if(func_prevPost()){ // your code … Read more
Firstly, you should never use query_posts to construct custom queries. This is not just my emphasis, but the codex as well. The one big problem with query_posts is, it many circumstances, pagination fails Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to … Read more
OMG, finally, as the code runs from the plugin, the current working directory is set to wp-admin whereas when i run it manually it set for /wp-content/plugins… So, when the push function is called, just add the following line of code: chdir(ABSPATH . ‘wp-content/plugins/*your plugins folder name*/’);
If you’re using an absolute reference like that, you’d want to include the full file path, like http://diginomics.com/wp-content/themes/THEMENAME/css/style.css I believe any time you call the functions like get_stylesheet_directory() or get_stylesheet_directory_uri() it will return the path for the current theme. Just keep in mind that all themes need a style.css file. I would have posted this … Read more
Use get_permalink (which returns the URL) instead of the_permalink (which prints the URL). Try: foreach ( $categories as $category ) { $link = get_term_link( $category ); $html .= “<li><a href=”https://wordpress.stackexchange.com/questions/159187/{$link}” data-filter=”{$category->category_nicename}”>{$category->cat_name}</a></li>”; }