I have recently written a blog post using blogdown through RStudio, and I am trying to use internal hyperlinks within the post. Specifically, I am trying to link a 'string of text' to another 'string of text' in a different section of the script.
For instance, I created a blog post that defines some functions in the first section of the document, and my goal was to link those function names to the section of the document where I give examples on using that specific function.
To clarify, it works great when I knit my Rmd; however, it stops working once the blog is posted. Although the function names still appear to be hyperlinked, you are actually brought to the home page of my website, and not the example section of the post which is what I want. If anyone could provide any suggestions or resources I would really appreciate it! Thank you!!
Please find the blog post here (with the internal hyperlinks not working) http://sarahrsalter.com/blog/2018-02-18-dplyr/.
Here is the Rmd code:
+ [**select()**](#Select): evaluates a subset of specified variables
(columns) within a dataset.
## II) Select Functions <a id="Select"></a>
### Example 1
Related
I have posts that are assigned to two categories let's say cars and paints. I'm trying to only get posts that are in both, the following code http://example.com/category/cars+paints is supposed to work according to this article but it doesn't and I get a page saying The requested document was not found on this server. When I try http://exapmle.com/category/cars,paints it works but it gives me too many posts.
It seems that & is supposed to work as well, I tried http://exapmle.com/category/cars&paints and http://exapmle.com/category/?cat=cars&cat=paints but this doesn't either work, I don't know if I have the syntax wrong.
When I try http://exapmle.com/?cat=1&cat=2 using the category IDs it directs to a page like this http://exapmle.com/category/paints with the last parameter corresponding to the last number entered in the URL.
Does anyone know why it's not working and what I can do to get it to work, thanks in advance.
Changing the + to a space %20 seems to be working for me
Example:
http://example.com/category/cars%20paints
I am using IBM DiffMerge to generate a Report that shows all differences between two .cls files or .sbs files. I was playing with it and I saw that there is a filed in option menu that allows you to change the format of the report, but it implies some keywords, like $elemname to print the element's name or $elemtype to print its type $leftonly or $rightonly which show how many differences are in the left diagram or in the right one.
Now, I was wondering if there are more variables like those above, especially one that can print a component's GUID (unique ID in Rhapsody).
Thanks,
Daniel
I would expect that $GUID will give you what you're looking for.
Under the ReporterPlus installation folder there is a folder named Templates. In it you'll find a file named DiffReport.dpl which you can load it into ReporterPlus for editing like any other template. You must run Rep+ with a command line option so that it loads with the Diffmerge specific schema:
Reporter.exe /mode=dfm
After that you can load the Diffmerge template, and edit it to customize the output of DiffMerge reports. When you do, try adding $GUID into the output.
Regards, Simon
I tried the following functions in header.php, footer.php, single.php etc.
var_dump(in_the_loop());
var_dump(get_the_id());
The first function gives false (meaning we are not in the loop) and the second function gives the post id every single time.
Description of get_the_id() from wordpress :
Retrieve the numeric ID of the current post. This tag must be within The Loop.
I just want a simple explanation what the hell is going on why do i get the post id if I call the function out of the loop !?
must is a little strong for get_the_id() ...delivers evil eye to Wordpress.
It works in the header and non-loop (confirmed).
Please note that post/page are essentially interchangeable in this conversation.
Think of WP this way -> You always have a post id in some way, all the time, every page, unless you do weird stuff or talk about non-page edge cases. When you are at the install root (such as site.com/) there are posts being called, something has to be displayed. There are other settings that will impact post/page such as static front page settings. On a category listing, if there are pages, I got the first ID returned before the loop.
On post/pages the page ID is (more or less0 set before the loop. This is a result of the URL (pretty or ?p=123 format) dictating the content. Using pretty names, the page at site.com/foo-bar/ will try to look up if there is content available via the permalink rules for "foo-bar". If there is content, the post ID is obtained. (simplified)
Later in the page build you get into the loop. However, before the loop you are also offered opportunities to change, sort, or augment the loop - such as changing the page IDs to be looped or sorting.
Regarding in_the_loop(), WP says
"True if caller is within loop, false if loop hasn't started or has ended." via http://codex.wordpress.org/Function_Reference/in_the_loop
in_the_loop() evaluates if the loop is in action (loop being key to the WP world). Also important - when you are in the loop WP can iterate over multiple page/post (IDs).
I don't have a 100% bulletproof explanation as to how the ID always shows, but when you dig into the API and various methods for hooking this might be a result.
I understand your confusion and agree with you. I think WP intended get_the_id() as a loop based tool, outside the loop you will get unpredictable results.
Hope that helps, I do enjoy working in WP, and I hope you do to.
I want to show adsense ads only on those posts and pages which are written in the year 2011 using variables outside the "loop". It there any way of doing it in wordpress ?
This can be accomplished by using variables in the Wordpress loop. The "loop" is commonly used for pulling data like this. This answer is only applicable if you plan to put the ad within the Wordpress loop.
This snippet of code can help you get started:
if(the_time('Y')=='2011') {
echo adsense_custom_function();
}
See more here: http://codex.wordpress.org/The_Loop_in_Action#Title.2C_Date_and_Author
I'm setting up a WordPress blog and I can't manage to link an author's name to the list of posts written by that author.
I am using this code:
written by <?php the_author() ?>
But this gives me following error:
Warning: Missing argument 1 for get_author_posts_url(), called in /customers/zinneket.be/zinneket.be/httpd.www/wp-content/themes/zinneket/index.php on line 15 and defined in /customers/zinneket.be/zinneket.be/httpd.www/wp-includes/author-template.php on line 220
Line 15 is of course the one copied above.
Does anyone know the right way to do this?
Thanks a lot.
The documentation makes it fairly clear that you need to provide an argument (to identify what author you're interested in).
From the looks of it, the_author_posts_link() is what you want to use.
Rule of thumb: the_ functions involve the current author/post/page/whatever, get_ functions require you to identify what author/post/page/whatever you are interested in.