Produce PDF documents of everything on your site with Latex.
If something isn't working, check this FAQ for a relevant answer. If there isn't one, create a new topic in the plugin forum and the author will try to get back to you.
Settings->Reading. There is a "Latex Everything" section where you can
choose which documents Latex Everything creates. By default only "Single Posts"
option is selected, but you can typeset other post types (including custom ones),
documents containing every post in a category (or other taxonomies), and
documents containing every post of a specific post type.
There are in fact three broad types of document Latex Everything produces:
single_post-- Each document contains a single post (this can be a page or a custom post type).
post_type-- Each document contains every post of a particular type (e.g. a post, a page, or a custom post type).
term-- Each post contains every post belonging to a specific term (e.g. a category, tag, or term in a custom taxonomy).
You need to know what sort of document you're looking for when getting its url.
PDF files that contain a post are updated when it is saved. PDF files are also generated in bulk after the plugin is activated (this uses WP-Cron, so it takes a while). If you have a large number of posts and want to generate PDF files for all of them, deactivate and reactivate the plugin, then wait.
Functions have been provided to link to the generated PDFs.
the_latex_url( $type, $arg1, [$arg2])-- Prints a direct link to the PDF.
get_latex_url( $type, $arg1, [$arg2])-- Returns a direct link to the PDF.
the_latex_permalink( $type, $arg1, [$arg2])-- Prints a link to the attachment page.
get_latex_permalink( $type, $arg1, [$arg2])-- Returns a link to the attachment page.
get_latex_attachment_id( $type, $arg1, [$arg])-- Returns the id of the attachment.
The arguments you give depend on the type of PDF document you're requesting:
the_latex_url( 'single_post', (int) $post_id )
the_latex_url( 'post_type', (string) $post_type )
the_latex_url( 'term', (int) $term_id, (string) $taxonomy)
Here's how you would use them in The Loop.
<a href="<?php the_latex_url( 'single_post', get_the_ID() ) ?>">PDF of this post</a> <a href="<?php the_latex_url( 'post_type', get_post_type() ) ?>">PDF of all posts</a> <?php foreach( get_the_category() as $category ) : ?> <a href="<?php the_latex_url( 'term', $category->cat_ID, 'category' ) ?>">PDF of a category</a> <?php endforeach; ?>
NB: These don't automatically figure out which post you're on while in The Loop, you must always give all of the arguments
If you are going to use these functions in a theme, check they exist and produce a url first:
<?php if( function_exists('get_latex_url') && $latex_url = get_latex_url( 'single_post', get_the_ID() ) ): ?> <a href="<?php echo $latex_url ?>">PDF</a> <?php endif; // get_latex_permalink ?>
Latex Everything has a default template inside the plugin directory, but it only falls back on that if it doesn't find templates in the theme directory. The plugin searches for templates in the same way that WordPress does.
latex-single-<post_type>-<post id>.php latex-single-<post_type>-<post slug>.php latex-single-<post_type>.php latex-single.php latex.php
latex-post-type-<post type name>.pdf latex-post-type.pdf latex.pdf
latex-term-<taxonomy>-<term id>.pdf latex-term-<taxonomy>-<term slug>.pdf latex-term-<taxonomy>.pdf latex-term.pdf latex.pdf
default-latex-template.php in the plugin directory for guidance as to
how to make your own.
The plugin has been built with the intention of being extensible. The internals have documentation in comments, and if you want to know how to do something that isn't obvious, create a new topic in the plugin forum and the author will try to get back to you.