-
AuthorPosts
-
May 17, 2018 at 2:56 pm #958193
So, after researching how best to do this in this form…for enfold of course, I have created a new function and added a shortcode for it. I drop a CODE tool on my page inside a column and add the new shortcode reference…and no one is more surprised than I, viola, I see my output. HOWEVER, that output is in the upper top left of my page content, just below the header. My expectation was that, by virtue of the aria containers and layout paradigm, that the output would have occurred exactly (ok roughly) where I placed my CODE tool on the page.
Why does it not and how do I stop that from happening. The actual custom code just creates a
- tag set of bullet items to display from my media directory of relevant PDFS as links to those files…and again keep in mind that it works, just displays in the wrong place.
May 19, 2018 at 9:27 am #958979Hey mcraig,
Where can we see the element in question? If you could share the code you are using then that would be helpful as well.
Best regards,
RikardMay 20, 2018 at 8:52 pm #959498This reply has been marked as private.May 21, 2018 at 9:04 pm #959976Hi,
Please try it as following
function boardminutesqv() { $args = array( 'post_type' => 'attachment', 'post_status' => 'inherit', // for PDFs 'post_mime_type' => 'application/pdf', // if you need PDFs from a specific media category 'tax_query' => array( array( 'taxonomy' => 'media_category', // your taxonomy 'field' => 'id', 'terms' => array(143,145) // term id (id of the media category) ) ) ); $query = new WP_Query( $args ); if ( $query->have_posts() ) { $output = '' $output .= '<ul>'; while ( $query->have_posts() ) { $query->the_post(); $output .= '<li><a href="' . get_the_permalink() . '">' . get_the_title() . '</a> (' . filesize( get_attached_file( get_the_ID() ) ) . ' bytes)</li>'; } $output .= '</ul>'; return $output; } else { // no PDFs found } wp_reset_postdata(); } add_shortcode( 'wpb_boardminutesqv', 'boardminutesqv' );
and now let me know if it works properly.
Best regards,
BasilisMay 28, 2018 at 1:06 pm #963154This reply has been marked as private.May 30, 2018 at 11:03 pm #964554 -
AuthorPosts
- You must be logged in to reply to this topic.