Display list of pages that contain a certain string within the slug
Display list of pages that contain a certain string within the slug
Display list of pages that contain a certain string within the slug
You need your shortcode to accept attributes. A shortcode with attributes would look like: [publication year=”2017″] Then in your add_shortcode callback function you receive attributes in the first parameter of the function: function wpse_279094_publication_shortcode( $atts ) { echo $atts[‘year’]; } add_shortcode( ‘publication’, ‘wpse_279094_shortcode’ ); You want to be able to account for a user not … Read more
Copied from my Answer for “An old plugin self-made stoped sending mail”: Many E-Mail-Hosters changed their rules to prevent spam. Often times, E-Mails that have one domain name in their “from”-Tag and come from a server with a different domain are rejected. So my guess is, maybe the emails are still sent, but not received. … Read more
Open to anybody who can simplify this but here’s what I came up with that worked for me. First thing’s first – get the gallery, using get_post_gallery(), as soon as the loop starts: <?php if( have_posts() ) : ?> <?php while( have_posts() ) : the_post(); $gallery = get_post_gallery(); $content = strip_shortcode_gallery( get_the_content() ); ?> <div … Read more
Hide shortcodes content from the excerpt?
Shortcode in excerpt
Does the TOC need to be a shortcode? Perhaps giving the editors a meta box with a set of radio boxes for none, below and above options would be cleaner? You could then generate the TOC via the static variable approach you mentioned and output it during page render.
That simply is too late for a shortcode. Just try putting it in your themes functions.php file. Aside from that, using shortcodes imo are not a good idea. When you decide to change it, it will still stay in the database. This means either going through all places in the DB to clean up the … Read more
I created a function to retrieve attachment id from it’s src, might work in your case scenario as well function get_attachment_id_from_src ($image_src) { global $wpdb; $id = $wpdb->get_var(‘SELECT ID FROM ‘.$wpdb->posts.’ WHERE guid=”‘.$image_src.'”‘); return $id; }
There is a plugin called Just Variables – which is doing just that https://wordpress.org/plugins/just-wp-variables/ – you can have a look at its code and it will provide you with the best explanation on how to do that. (or you can alternatively just use the plugin.)