cyberchimps_display_upsell

The Responsive II cyberchimps display upsell function.

Description

cyberchimps_display_upsell(); 

Usage

  1. if ( !function_exists( 'cyberchimps_display_upsell' ) ) { 
  2. require_once '/core/functions-theme-upsell.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cyberchimps_display_upsell(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/core/functions-theme-upsell.php  
  1. function cyberchimps_display_upsell() { 
  2.  
  3. // Set template directory uri 
  4. $directory_uri = get_template_directory_uri(); 
  5. ?> 
  6. <div class="wrap"> 
  7. <div class="container-fluid"> 
  8. <div id="upsell_container"> 
  9. <div class="row"> 
  10. <div id="upsell_header" class="col-md-12"> 
  11. <h2> 
  12. <a href="http://cyberchimps.com" target="_blank"> 
  13. <img src="<?php echo $directory_uri; ?>/core/images/cyberchimps-logo.png"/> 
  14. </a> 
  15. </h2> 
  16.  
  17. <h3><?php _e( 'Themes You Can Trust', 'responsive-II' ); ?></h3> 
  18. </div> 
  19. </div> 
  20.  
  21. <div id="upsell_themes" class="row"> 
  22. <?php 
  23. // Set the argument array with author name. 
  24. $args = array( 
  25. 'author' => 'cyberchimps',  
  26. ); 
  27.  
  28. // Set the $request array. 
  29. $request = array( 
  30. 'body' => array( 
  31. 'action' => 'query_themes',  
  32. 'request' => serialize( (object)$args ) 
  33. ); 
  34. $themes = cyberchimps_get_themes( $request ); 
  35. $active_theme = wp_get_theme()->get( 'Name' ); 
  36. $counter = 1; 
  37.  
  38. // For currently active theme. 
  39. foreach ( $themes->themes as $theme ) { 
  40. if( $active_theme == $theme->name ) {?> 
  41.  
  42. <div id="<?php echo $theme->slug; ?>" class="theme-container col-md-6 col-lg-4"> 
  43. <div class="image-container"> 
  44. <img class="theme-screenshot" src="<?php echo $theme->screenshot_url ?>"/> 
  45.  
  46. <div class="theme-description"> 
  47. <p><?php echo $theme->description; ?></p> 
  48. </div> 
  49. </div> 
  50. <div class="theme-details active"> 
  51. <span class="theme-name"><?php echo $theme->name . ':' . __( 'Current theme', 'responsive-II' ); ?></span> 
  52. <a class="button button-secondary customize right" target="_blank" href="<?php echo get_site_url(). '/wp-admin/customize.php' ?>">Customize</a> 
  53. </div> 
  54. </div> 
  55.  
  56. <?php 
  57. $counter++; 
  58. break; 
  59.  
  60. // For all other themes. 
  61. foreach ( $themes->themes as $theme ) { 
  62. if( $active_theme != $theme->name ) { 
  63.  
  64. // Set the argument array with author name. 
  65. $args = array( 
  66. 'slug' => $theme->slug,  
  67. ); 
  68.  
  69. // Set the $request array. 
  70. $request = array( 
  71. 'body' => array( 
  72. 'action' => 'theme_information',  
  73. 'request' => serialize( (object)$args ) 
  74. ); 
  75.  
  76. $theme_details = cyberchimps_get_themes( $request ); 
  77. ?> 
  78.  
  79. <div id="<?php echo $theme->slug; ?>" class="theme-container col-md-6 col-lg-4 <?php echo $counter % 3 == 1 ? 'no-left-megin' : ""; ?>"> 
  80. <div class="image-container"> 
  81. <img class="theme-screenshot" src="<?php echo $theme->screenshot_url ?>"/> 
  82.  
  83. <div class="theme-description"> 
  84. <p><?php echo $theme->description; ?></p> 
  85. </div> 
  86. </div> 
  87. <div class="theme-details"> 
  88. <span class="theme-name"><?php echo $theme->name; ?></span> 
  89.  
  90. <!-- Check if the theme is installed --> 
  91. <?php if( wp_get_theme( $theme->slug )->exists() ) { ?> 
  92.  
  93. <!-- Show the tick image notifying the theme is already installed. --> 
  94. <img data-toggle="tooltip" title="<?php _e( 'Already installed', 'responsive-II' ); ?>" data-placement="bottom" class="theme-exists" src="<?php echo $directory_uri ?>/core/images/tick.png"/> 
  95.  
  96. <!-- Activate Button --> 
  97. <a class="button button-primary activate right" 
  98. href="<?php echo wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . urlencode( $theme->slug ) ), 'switch-theme_' . $theme->slug );?>" >Activate</a> 
  99. <?php } 
  100. else { 
  101.  
  102. // Set the install url for the theme. 
  103. $install_url = add_query_arg( array( 
  104. 'action' => 'install-theme',  
  105. 'theme' => $theme->slug,  
  106. ), self_admin_url( 'update.php' ) ); 
  107. ?> 
  108. <!-- Install Button --> 
  109. <a data-toggle="tooltip" data-placement="bottom" title="<?php echo 'Downloaded ' . number_format( $theme_details->downloaded ) . ' times'; ?>" class="button button-primary install right" href="<?php echo esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ); ?>" ><?php _e( 'Install Now', 'responsive-II' ); ?></a> 
  110. <?php } ?> 
  111.  
  112. <!-- Preview button --> 
  113. <a class="button button-secondary preview right" target="_blank" href="<?php echo $theme->preview_url; ?>"><?php _e( 'Live Preview', 'responsive-II' ); ?></a> 
  114. </div> 
  115. </div> 
  116. <?php 
  117. $counter++; 
  118. }?> 
  119. </div> 
  120. </div> 
  121. </div> 
  122. </div> 
  123.  
  124. <script> 
  125. jQuery(function () { 
  126. jQuery('.download').tooltip(); 
  127. jQuery('.theme-exists').tooltip(); 
  128. }); 
  129. </script> 
  130. <?php