You can set most settings in the Settings -> PDF Embedder page in WordPress. These apply to all embeds by default, but you can override the settings of individual embeds by manually adding shortcode parameters to the individual pdf-embedder
shortcodes – see details here.
It is also possible to override the global defaults by writing PHP code, using several filters.
In both of the examples below, you can apply the changes based on the $atts['url']
value. This way different PDF files can have different rules which is very handy when PDF files have a certain naming pattern.
Override shortcode attributes in Lite & Premium
For example, to add the pagetextbox
option to every embed so you don’t have to add it to every shortcode manually (there is no global setting available for this parameter), you could add the following code to your Theme’s functions.php or similar:
add_filter( 'pdfemb_filter_shortcode_attrs', 'pdfemb_docs_change_sc_atts', 10, 1 );
function pdfemb_docs_change_sc_atts( $atts ) {
$atts['pagetextbox'] = 'on';
return $atts;
}
Code language: PHP (php)
Override shortcode/block attributes in Attachment Pages
This is mainly applicable to Attachment Pages functionality, as they are loading a bit differently.
The code inside the function is the same, but the filter itself is different:
add_filter( 'pdfemb_premium_viewer_render_atts', 'pdfemb_docs_change_attpages_atts', 10, 1 );
function pdfemb_docs_change_attpages_atts( $atts ) {
$atts['pagetextbox'] = 'on';
return $atts;
}
Code language: PHP (php)