Guest User

acc gallery not working wordpress 5.5

a guest
Aug 28th, 2020
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * The default template for displaying content
  4. *
  5. * Used for both single and index/archive/search.
  6. *
  7. * @package WordPress
  8. * @subpackage Twenty_Fifteen
  9. * @since Twenty Fifteen 1.0
  10. */
  11. ?>
  12. <article id="post-<?php
  13. the_ID();
  14. ?>" <?php
  15. post_class();
  16. ?>>
  17. <header class="entry-header">
  18. <?php
  19. $current_gallery = get_field('gallery');
  20. if (get_query_var('page')) {
  21. $current_page = get_query_var('page');
  22.  
  23. } else {
  24. $current_page = 1;
  25. }
  26.  
  27. //Setup pagination variables
  28. $splitnumber = get_field('splitnum');
  29. if (!empty($splitnumber)) {
  30. $splitnum = $splitnumber;
  31. }
  32. if (empty($splitnumber)) {
  33. $splitnum = 8;
  34. }
  35. $images = array(); // Set images array for current page
  36. $items_per_page = $splitnum; // How many items we should display on each page
  37. $total_items = count($current_gallery); // How many items we have in total
  38. $num = $total_items;
  39. $total_pages = ceil($total_items / $items_per_page); // How many pages we have in total
  40. $translated = __('Page', 'pixplus'); // Supply translatable string
  41. $pagenum = 1;
  42. //$result = get_pagenum_link($pagenum, true);
  43. $big = 999999999;
  44. $pagination = paginate_links(array(
  45. 'end_size' => 3,
  46. 'mid_size' => 1,
  47. 'base' => get_permalink() . '%#%' . '/',
  48. 'format' => '%#%',
  49. 'current' => $current_page,
  50. 'total' => $total_pages,
  51. 'before_page_number' => '<span class="screen-reader-text">' . $translated . ' </span>',
  52. 'prev_next' => 'true',
  53. 'link_before' => '',
  54. 'link_after' => '',
  55. 'prev_text' => __('< Previous'),
  56. 'next_text' => __('Next >')
  57. ));
  58. $taxonomy = 'category';
  59. // Get the term IDs assigned to post.
  60. $post_terms = wp_get_object_terms($post->ID, $taxonomy, array(
  61. 'fields' => 'ids'
  62. ));
  63. // Separator between links.
  64. $separator = ' ';
  65. if (!empty($post_terms) && !is_wp_error($post_terms)) {
  66. echo '<div class="cat-links"><ul>';
  67. $term_ids = implode(',', $post_terms);
  68. $terms = wp_list_categories(array(
  69. 'title_li' => '',
  70. 'style' => 'none',
  71. 'echo' => false,
  72. 'taxonomy' => $taxonomy,
  73. 'include' => $term_ids
  74. ));
  75. $terms = rtrim(trim(str_replace('<br />', $separator, $terms)), $separator);
  76. // Display post categories.
  77. echo $terms;
  78. echo '</ul></div>';
  79. }
  80. if (is_single()):
  81. the_title('<div class="page-title-number"><h1 class="entry-title">', '</h1>');
  82. echo '<h3>Page ' . $current_page . ' of ' . $total_pages . '</h3><button title="Copy the URL of this page to the clipboard" data-clipboard-target="#copy-me" class="url-copy"></button></div>';
  83. $first_page = ($total_pages == 1);
  84. $not_first_page = ($current_page != 1);
  85. $not_last_page = ($current_page != $total_pages);
  86. $last_page = ($total_pages != 1 && $current_page >= $total_pages);
  87. if ($last_page) {
  88. echo '<p>Made this origami? Leave a comment & submit your photo <a href="#comments">here</a>.</p>';
  89. }
  90. $dudeurl = get_post_meta(get_the_ID(), 'dude_url', true);
  91. $dudebutt = get_permalink($dudeurl);
  92. if ($not_last_page) {
  93. echo '<p>Made this origami? Leave a comment & submit your photo on the last page <a href="' . $dudebutt . $total_pages . '#comments">here</a>.</p>';
  94. }
  95. if ($total_pages == 1) {
  96. echo '<p>Made this origami? Leave a comment & submit your photo <a href="#comments">here</a>.</p>';
  97. }
  98. endif;
  99. ?>
  100. <div class="linky"><input id="copy-me" value="<?php echo $dudebutt; echo $current_page ?>/"></div>
  101.  
  102. </header><!-- .entry-header -->
  103.  
  104. <div class="entry-content">
  105. <?php
  106. if (function_exists('social_warfare')) {
  107. social_warfare();
  108. }
  109. echo '<div class="gallery-wrapper">';
  110. //Get current page
  111. if ($current_page === 1) {
  112. twentyfifteen_post_thumbnail();
  113. $key_3_value = get_post_meta(get_the_ID(), 'cat-title', true);
  114. // Check if the custom field has a value.
  115. if (!empty($key_3_value)) {
  116. echo '<h3><strong>';
  117. echo $key_3_value;
  118. echo '</strong></h3>';
  119. }
  120. echo '<div class="level-meta">';
  121. $key_1_value = get_post_meta(get_the_ID(), 'level', true);
  122. // Check if the custom field has a value.
  123. if (!empty($key_1_value)) {
  124. echo '<p>Level: ';
  125. echo $key_1_value;
  126. echo '</p>';
  127. }
  128. $key_2_value = get_post_meta(get_the_ID(), 'copyright', true);
  129. // Check if the custom field has a value.
  130. if (!empty($key_2_value)) {
  131. echo '<p>Copyright: ';
  132. echo $key_2_value;
  133. echo ' <a title="more info/report mistake" href="https://origami.guide/about-us-copyright-information/">?</a></p>';
  134. }
  135. echo '</p></div>';
  136. /* translators: %s: Name of current post */
  137. the_content(sprintf(__('Continue reading %s', 'twentyfifteen'), the_title('<span class="screen-reader-text">', '</span>', false)));
  138. echo do_shortcode('[sc name="moonad"]');
  139. ?>
  140. <?php
  141. if (!empty($key_3_value)) {
  142. echo '<h3><strong>';
  143. echo $key_3_value;
  144. echo ' Instructions</strong></h3>';
  145. }
  146. $cattitle = get_field('cat-title');
  147. $video = get_field('video');
  148. if ($video && $cattitle) {
  149. echo '<p></p><p>Scroll down to follow the photo tutorial for the <span style="text-transform: capitalize">' . $cattitle . '</span>, there is also a video tutorial available at the end (on the last page).</p>';
  150. }
  151. }
  152. $starting_point = (($current_page - 1) * $items_per_page); // Get starting point for current page
  153. // Get elements for current page
  154. if ($current_gallery) {
  155. $images = array_slice($current_gallery, $starting_point, $items_per_page);
  156. }
  157. $i = $starting_point;
  158. if ($images) {
  159. $n = 4; //or whatever you want to chunk into
  160. $ny = 8;
  161. echo '<section class="gallery-post"><ol class="post-gal">'; //always open one
  162. $lcv = 1; // loop count variable
  163. $lcv2 = 1;
  164. $starting_pointy = (($current_page - 1) * $items_per_page + 1);
  165. foreach ($images as $image) {
  166. $tot_stuff = $starting_pointy++;
  167. $size = 'large';
  168. echo '<li>
  169.  
  170. <div class="linky"><input id="copy-me' . $tot_stuff . '" value="' . $dudebutt . $current_page . '#' . $tot_stuff . '" id="myInput" ></div>
  171.  
  172.  
  173. <span class="count" id="' . $tot_stuff . '">' . $tot_stuff . '</span>
  174. <div class="step-image">
  175. <span class="link-step">
  176. <button title="Copy the URL of this step to the clipboard" data-clipboard-target="#copy-me' . $tot_stuff . '" class="url-copy"></button></span><a href="' . $image['url'] . '">' . wp_get_attachment_image($image['ID'], $size, true, array(
  177. "class" => "nopin mobx"
  178. )) . '</a></div>';
  179. if (get_field('auto_count_captions') == 'yes') {
  180. echo '<p><span class="">' . $tot_stuff . '. </span>' . $image['caption'] . '</p></li>';
  181. } else {
  182. echo '<p>' . $image['caption'] . '</p></li>';
  183. }
  184. if ($lcv++ % $n == 0 && $lcv < $num) { // every Nth item, unless we're done
  185. echo do_shortcode('[sc name="post ad banner"]');
  186. }
  187. if ($lcv2++ % $ny == 0 && $lcv2 < $num) { // every Nth item, unless we're done
  188. }
  189. }
  190. echo "</ol></section>"; //always close the last one.
  191. }
  192. echo '</ol></section>';
  193. if ($current_page >= $total_pages) {
  194. $cattitle = get_field('cat-title');
  195. $video = get_field('video');
  196. if ($video && $cattitle) {
  197. echo '<section class="gallery-post"><div id="video"><h2>Video Tutorial</h2>';
  198. echo '<p>A video tutorial for the <span style="text-transform: capitalize">' . $cattitle . '</span> is available:</p>';
  199. echo '<iframe width="720" height="405" src="https://www.youtube.com/embed/' . $video . '?rel=0&amp;controls=1&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div></section>';
  200. }
  201. $conclusion = get_field('conclusion');
  202. $conclusioncol = get_field('conclusion-bg');
  203. if ($conclusion) {
  204. echo '<div class="conclusion" style="background:' . $conclusioncol . '!important;"><h3 style=" color:white; margin:10px 0 0 0;">Your ' . $cattitle . ' is Complete!</h3><p>' . $conclusion . '</p><p>Made this origami? Leave a comment & submit your photo <a href="#comments">here</a>.</p>';
  205. }
  206. ?>
  207.  
  208. <?php
  209. echo '</div>';
  210. }
  211. if ($pagination) {
  212. echo '<div class="pagination-wrapper">';
  213. if (($not_first_page) & ($total_pages >= 3)) {
  214. echo '<a href="' . $dudebutt . '"> << FIRST</a> ';
  215. }
  216. echo $pagination;
  217. if (($not_last_page) & ($total_pages >= 3)) {
  218. echo ' <a href="' . $dudebutt . $total_pages . '">LAST >> </a>';
  219. }
  220. echo '</div></div>';
  221. }
  222. ?>
  223. <?php
  224. if (function_exists('social_warfare')) {
  225. social_warfare();
  226. }
  227. ?>
  228.  
  229. <div class="tags">
  230. <?php
  231. echo show_tags_except_hidden();
  232. ?>
  233. </div>
  234. <?php
  235. echo do_shortcode('[sc name="gbannerresponsive"]');
  236.  
  237. echo "<h3>What To Fold Next?</h3><ul class='prev-next'>";
  238. // Get primary (Yoast) term if it is set
  239.  
  240. $currentID = get_the_ID();
  241. $category = get_the_category();
  242.  
  243.  
  244. $category_display = '';
  245. $category_slug = '';
  246. if (class_exists('WPSEO_Primary_Term')) {
  247. // Show the post's 'Primary' category, if this Yoast feature is available, & one is set
  248. $wpseo_primary_term = new WPSEO_Primary_Term('category', get_the_id());
  249. $wpseo_primary_term = $wpseo_primary_term->get_primary_term();
  250. $term = get_term($wpseo_primary_term);
  251. if (is_wp_error($term)) {
  252. // Default to first category (not Yoast) if an error is returned
  253. $category_display = $category[0]->term_id;
  254. $category_slug = $category[0]->slug;
  255. } else {
  256. // Set variables for category_display & category_slug based on Primary Yoast Term
  257. $category_id = $term->term_id;
  258. $category_term = get_category($category_id);
  259. $category_display = $term->term_id;
  260. $category_slug = $term->slug;
  261. }
  262. } else {
  263. // Default, display the first category in WP's list of assigned categories
  264. $category_display = $category[0]->term_id;
  265. $category_slug = $category[0]->slug;
  266. }
  267. previous_post_link_plus(array(
  268. 'order_by' => 'menu_order',
  269. 'order_2nd' => 'post_date',
  270. 'in_cats' => $category_display,
  271. 'meta_key' => '',
  272. 'post_type' => '',
  273. 'loop' => true,
  274. 'end_post' => false,
  275. 'in_same_tax' => 'category',
  276. 'thumb' => 'thumbnail',
  277. 'max_length' => 0,
  278. 'format' => '&laquo; %link ',
  279. 'link' => '%title',
  280. 'date_format' => '',
  281. 'tooltip' => '%title',
  282. 'in_same_cat' => true,
  283. 'before' => '<li>',
  284. 'after' => '</li>'
  285. ));
  286. next_post_link_plus(array(
  287. 'order_by' => 'menu_order',
  288. 'order_2nd' => 'post_date',
  289. 'in_cats' => $category_display,
  290. 'meta_key' => '',
  291. 'post_type' => '',
  292. 'loop' => true,
  293. 'end_post' => false,
  294. 'in_same_tax' => 'category',
  295. 'thumb' => 'thumbnail',
  296. 'max_length' => 0,
  297. 'format' => '%link &raquo;',
  298. 'link' => '%title',
  299. 'date_format' => '',
  300. 'tooltip' => '%title',
  301. 'in_same_cat' => true,
  302. 'before' => '<li>',
  303. 'after' => '</li>'
  304. ));
  305. echo '</ul>';
  306.  
  307. ?>
  308. <?php
  309. if ($current_page >= $total_pages) {
  310. if (comments_open() || get_comments_number()) {
  311. comments_template();
  312. }
  313. }
  314.  
  315. echo do_shortcode('[sc name="gbannerresponsive"]');
  316. ?>
  317.  
  318. </div><!-- .entry-content -->
  319.  
  320. <footer class="entry-footer">
  321. </footer><!-- .entry-footer -->
  322.  
  323. </article><!-- #post-## -->
RAW Paste Data