Print-Pro-Matic: Add PDF to Print Page

The following is an example of how to add a pdf document to be printed along with a target using the new add_print_url attribute.

First, we need a simple target to print:

<div id="print_target">This is the simple print target for the page</div>

Now, we simply add our print-me shortcode and use the add_pdf_url attribute to include a pdf document to be printed:

[print-me target="#print_target" add_pdf_url="https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf" pause_time="3000"/]

Direct PDF Print

As of version 1.2.6 we have introduced a new shortcode to print-pro-matic, just for printing PDFs.Note: the ability to print pdf files from javascript is currently not supported in FireFox. Therefore the PDF will open in a new tab and the user can print from there.

[[print-pdf pdf_url="https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf"/]]

This will produce a simple button that will print the pdf:
[print-pdf pdf_url=”https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf” /]

The optional attirbutes for the print-pdf shortcode are as follows:
id
The ID attribute will assign a custom ID to the button. If no ID is assigned a random id will be assigned.

title
The title attribute will assign the text of the print button. If no title is assigned, the button will have the tex of: ‘Print PDF’

class
The class attribute will assign the button a custom class.

tag
The tag attribute will change the trigger element from the default button to, say a div. For example:

[[print-pdf pdf_url="url_to_pdf" tag="div"/]]

img_url
The img_url attribute is used to define the image URL to use as a trigger. Using a trigger image will override standard print trigger, replacing it with the chosen image.

[[print-pdf img_url="url_to_trigger_image"/]]

width
Use the width attribute along with the img_url to define the image width.

height
Use the height attribute along with the img_url to define the image height.

alt
Use the alt attribute along with the img_url to define the image alt value.

Demo of Trigger Image:

[[print-pdf img_url="https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg" alt="" width="600" height="447" pdf_url="https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf"]]
[print-pdf img_url=”https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg” alt=”” width=”600″ height=”447″ pdf_url=”https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf”]

redirect_url
Full url to redirect the user to after either a) the print dialogue closes or b) the pdf is loaded into a new tab (depending on which browser is being used)

[[print-pdf pdf_url="url_to_pdf" redirect_url="http://starwars.wikia.com/wiki/Main_Page"/]]
[print-pdf pdf_url=”https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf” redirect_url=”http://starwars.wikia.com/wiki/Main_Page” title=”Print & Redirect”/]

Putting it all Together

Here we will have a trigger image that redirects on print close:

[[print-pdf img_url="https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg" alt="" width="600" height="447" pdf_url="https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf" redirect_url="http://starwars.wikia.com/wiki/Main_Page" title="Ninja Power"]]
[print-pdf img_url=”https://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles.jpg” alt=”” width=”600″ height=”447″ pdf_url=”https://spacedonkey.de/wp-content/uploads/2012/06/RomeSweetRome1-8v22.pdf” redirect_url=”http://starwars.wikia.com/wiki/Main_Page” title=”Ninja Power”]

Collapse-O-Matic External Triggers for Nested Element

Here is a nested expand to test this issue.

[expand title="Level 1" id="q1" rel="top-highlander" trigclass="must-be-one" expanded="true"]
   [expandsub1 title="Nested Level a1" id="a1" rel="a-highlander"]answer a1[/expandsub1]
   [expandsub1 title="Nested Level a2" id="a2" rel="a-highlander"]answer a2[/expandsub1]
[/expand]
[expand title="Level 2" id="q2" rel="top-highlander" trigclass="must-be-one"]
   [expandsub1 title="Nested Level b1" id="b1" rel="b-highlander"]answer b1[/expandsub1]
   [expandsub1 title="Nested Level b2" id="b2" rel="b-highlander"]answer b2[/expandsub1]
[/expand]
Level 1
Nested Level a1
answer a1
Nested Level a2
answer a2
Level 2
Nested Level b1
answer b1
Nested Level b2
answer b2

Here are some external triggers:

<a class="expandanchor" href="#q1">Level 1</a>
<a class="expandanchor" href="#a1">Level 1a</a>
<a class="expandanchor" href="#a2">Level 1b</a>
<a class="expandanchor" href="#q2">Level 2</a>
<a class="expandanchor" href="#b1">Level 2a</a>
<a class="expandanchor" href="#b2">Level 2b</a>

Level 1
Level 1a
Level 1b
Level 2
Level 2a
Level 2b

T(-) Countdown Control – Calculating Labor Day & Other Holidays

Using the new %this year% and %this_easter% placeholders introduced with T(-) Countdown Control version 1.8.0, it’s easy to calculate holidays such as labor day like so:

Launch Strtotime: september %this_year% first monday

As of version 1.8.2, using these shortcodes will automatically recalculate for next year’s date after the holiday has past. Holidays should be set as recurring ‘Yearly’ and they will automatically be rescheduled for next year.

Other Holidays can be calculated in the same manner:

  • New Years: first day of january %this_year%
  • Martin Luther King, Jr. Day: january %this_year% third monday
  • President’s Day: february %this_year% third monday
  • Easter: %this_easter%
  • Ascension Day: %this_easter% + 40 days
  • Pentecost: %this_easter% + 50 days
  • Memorial Day: last monday of may
  • Independence Day: july 4 %this_year%
  • Labor Day: september %this_year% first monday
  • Columbus Day: october %this_year% second monday
  • Veteran’s Day: november 11 %this_year%
  • Thanksgiving Day: november %this_year% fourth thursday
  • Christmas Day: december 25 %this_year%

Tests

Ascension Day

weeks
-286
-9
days
0
-4
hours
-1
-8
minutes
0
-1
seconds
0
-5

Eight Days before Thanksgiving

november %this_year% fourth thursday + 14 hours 30 minutes – 8 days

weeks
-286
-9
days
0
-4
hours
-1
-8
minutes
0
-1
seconds
0
-5

Collapse-O-Matic, Graphene Theme & Any Mobile Switcher Test

First let’s test the mobile-only and mobile-exclude shortcodes to see if they are included with the plugin. No, they are not.

Now we install the Graphene Theme and test…
Oops, wrong Graphene Theme. It seems This Theme is all that is required for testing the shortcodes.

Mobile Only

[[mobile only]...[/mobile-only]]

[mobile only]
this is some text that should only show up on mobile devices
[/mobile-only]

Mobile Exclude

[[mobile exclude]...[/mobile-exclude]]

[mobile-exclude]
this is some text that should only show up on non-mobile devices
[/mobile-exclude]

Print-O-Matic Multiple Target Test

This is a test of Print-O-Matic using multiple targets, for example:

This is an element inside of a div with an ID called: targ_id_one
This is a second element that is wrapped in a div with an ID of: targ_id_two

And now for the trigger:

[print-me target="#targ_id_one, #targ_id_two"/]
print me
print me

Collapse-O/Pro-Matic Roll-Your-Own Method Slider Effect and Duration

Roll-Your-Own Method

We have already demonstrated how the new animation_effect and duration attributes work with a shortcode. Now we will show the same example but using the roll-your-own method. As always, the default effect is slideFade and duration is fast, but these can be overwritten globally in the plugin settings. As of version 1.7.3 these attributes can be applied on a collapse element basis using two new data-atributes: data-effect and data-duration.

<div class="collapseomatic" id="monkey" title="Monkeys">Monkeys</div>
<div id="target-monkey" class="collapseomatic_content">....</div>

<div class="collapseomatic" id="donkey" data-duration="slow" title="Donkeys">Donkeys</div>
<div id="target-donkey" class="collapseomatic_content">....</div>

<div class="collapseomatic" id="ninja" data-duration="1" data-animation_effect="slideToggle" title="Ninjas">Ninjas</div>
<div id="target-ninja" class="collapseomatic_content">....</div>
Monkeys
A monkey is a primate of the Haplorrhini suborder and simian infraorder, either an Old World monkey or a New World monkey, but excluding apes and humans. There are about 260 known living species of monkey. Many are arboreal, although there are species that live primarily on the ground, such as baboons. Monkeys are generally considered to be intelligent. Unlike apes, monkeys usually have tails. Tailless monkeys may be called “apes”, incorrectly according to modern usage; thus the tailless Barbary macaque is called the “Barbary ape”.
Donkeys
The donkey or ass, Equus africanus asinus,[1][2] is a domesticated member of the Equidae or horse family. The wild ancestor of the donkey is the African wild ass, E. africanus. The donkey has been used as a working animal for at least 5000 years. There are more than 40 million donkeys in the world, mostly in underdeveloped countries, where they are used principally as draught or pack animals. Working donkeys are often associated with those living at or below subsistence levels. Small numbers of donkeys are kept for breeding or as pets in developed countries.
Ninjas
A ninja (忍者?) or shinobi (忍び?) was a covert agent or mercenary in feudal Japan who specialized in unorthodox warfare. The functions of the ninja included espionage, sabotage, infiltration, and assassination, and open combat in certain situations.[1] Their covert methods of waging war contrasted the ninja with the samurai, who observed strict rules about honor and combat.[2] The shinobi proper, a specially trained group of spies and mercenaries, appeared in the Sengoku or “warring states” period, in the 15th century,[3] but antecedents may have existed in the 14th century,[4] and possibly even in the 12th century (Heian or early Kamakura era).

Collapse-O/Pro-Matic Slider Effect and Duration Attributes

Currently the slide effect and duration can be set globally under the plugin settings, but what if we want to set it individually per collapse element? We need the ability to add this via a shortcode attribute and as a data attribute for the roll-your-own method.

Shortcode Attributes

Default animation_effect is slideFade and duration is fast. As of version 1.7.3 these can be overridden using two new attributes: animation_effect and duration. Since using a shortcode will save the default effect and speed to a variable, we need to set up a separate test for the roll-your-own method

[expand title="Monkeys"]...[/expand]
[expand title="Donkeys" duration="slow"]...[/expand]
[expand title="Ninjas" animation_effect="slideToggle"]...[/expand]

Monkeys
A monkey is a primate of the Haplorrhini suborder and simian infraorder, either an Old World monkey or a New World monkey, but excluding apes and humans. There are about 260 known living species of monkey. Many are arboreal, although there are species that live primarily on the ground, such as baboons. Monkeys are generally considered to be intelligent. Unlike apes, monkeys usually have tails. Tailless monkeys may be called “apes”, incorrectly according to modern usage; thus the tailless Barbary macaque is called the “Barbary ape”.

Donkeys
The donkey or ass, Equus africanus asinus,[1][2] is a domesticated member of the Equidae or horse family. The wild ancestor of the donkey is the African wild ass, E. africanus. The donkey has been used as a working animal for at least 5000 years. There are more than 40 million donkeys in the world, mostly in underdeveloped countries, where they are used principally as draught or pack animals. Working donkeys are often associated with those living at or below subsistence levels. Small numbers of donkeys are kept for breeding or as pets in developed countries.

Ninjas
A ninja (忍者?) or shinobi (忍び?) was a covert agent or mercenary in feudal Japan who specialized in unorthodox warfare. The functions of the ninja included espionage, sabotage, infiltration, and assassination, and open combat in certain situations.[1] Their covert methods of waging war contrasted the ninja with the samurai, who observed strict rules about honor and combat.[2] The shinobi proper, a specially trained group of spies and mercenaries, appeared in the Sengoku or “warring states” period, in the 15th century,[3] but antecedents may have existed in the 14th century,[4] and possibly even in the 12th century (Heian or early Kamakura era).[5][6]