@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function afterSetupTheme() |
| 18 | 18 | { |
| 19 | - add_editor_style( Theme::assetUri( 'css/editor.css' )); |
|
| 20 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
| 21 | - add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] ); |
|
| 22 | - add_theme_support( 'post-thumbnails' ); |
|
| 23 | - add_theme_support( 'soil-clean-up' ); |
|
| 24 | - add_theme_support( 'soil-jquery-cdn' ); |
|
| 25 | - add_theme_support( 'soil-nav-walker' ); |
|
| 26 | - add_theme_support( 'soil-nice-search' ); |
|
| 27 | - add_theme_support( 'soil-relative-urls' ); |
|
| 28 | - add_theme_support( 'title-tag' ); |
|
| 29 | - load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' ); |
|
| 30 | - |
|
| 31 | - $menus = apply_filters( 'castor/register/nav_menus', [ |
|
| 32 | - 'main_menu' => __( 'Main Menu', 'castor' ), |
|
| 19 | + add_editor_style(Theme::assetUri('css/editor.css')); |
|
| 20 | + add_theme_support('customize-selective-refresh-widgets'); |
|
| 21 | + add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); |
|
| 22 | + add_theme_support('post-thumbnails'); |
|
| 23 | + add_theme_support('soil-clean-up'); |
|
| 24 | + add_theme_support('soil-jquery-cdn'); |
|
| 25 | + add_theme_support('soil-nav-walker'); |
|
| 26 | + add_theme_support('soil-nice-search'); |
|
| 27 | + add_theme_support('soil-relative-urls'); |
|
| 28 | + add_theme_support('title-tag'); |
|
| 29 | + load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages'); |
|
| 30 | + |
|
| 31 | + $menus = apply_filters('castor/register/nav_menus', [ |
|
| 32 | + 'main_menu' => __('Main Menu', 'castor'), |
|
| 33 | 33 | ]); |
| 34 | 34 | |
| 35 | - foreach( $menus as $location => $description ) { |
|
| 36 | - register_nav_menu( $location, $description ); |
|
| 35 | + foreach ($menus as $location => $description) { |
|
| 36 | + register_nav_menu($location, $description); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function filterLoginTitle() |
| 45 | 45 | { |
| 46 | - return get_bloginfo( 'name' ); |
|
| 46 | + return get_bloginfo('name'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function filterLoginUrl() |
| 54 | 54 | { |
| 55 | - return get_bloginfo( 'url' ); |
|
| 55 | + return get_bloginfo('url'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @return string |
| 60 | 60 | * @filter template_include |
| 61 | 61 | */ |
| 62 | - public function filterTemplate( $template ) |
|
| 62 | + public function filterTemplate($template) |
|
| 63 | 63 | { |
| 64 | - if( is_string( $template )) { |
|
| 65 | - $template = Template::setLayout( $template ); |
|
| 66 | - Development::storeTemplatePath( $template ); |
|
| 64 | + if (is_string($template)) { |
|
| 65 | + $template = Template::setLayout($template); |
|
| 66 | + Development::storeTemplatePath($template); |
|
| 67 | 67 | } |
| 68 | 68 | return $template; |
| 69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | * @return array |
| 73 | 73 | * @filter {$type}_template_hierarchy |
| 74 | 74 | */ |
| 75 | - public function filterTemplateHierarchy( array $templates ) |
|
| 75 | + public function filterTemplateHierarchy(array $templates) |
|
| 76 | 76 | { |
| 77 | - return array_map( function( $template ) { |
|
| 78 | - return Utility::startWith( 'templates/', $template ); |
|
| 79 | - }, $templates ); |
|
| 77 | + return array_map(function($template) { |
|
| 78 | + return Utility::startWith('templates/', $template); |
|
| 79 | + }, $templates); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function login() |
| 87 | 87 | { |
| 88 | - if( file_exists( Theme::assetPath( 'css/login.css' ))) { |
|
| 89 | - printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' )); |
|
| 88 | + if (file_exists(Theme::assetPath('css/login.css'))) { |
|
| 89 | + printf('<link rel="stylesheet" href="%s">', Theme::assetUri('css/login.css')); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function registerAssets() |
| 98 | 98 | { |
| 99 | - wp_enqueue_style( 'castor/main.css', |
|
| 100 | - Theme::assetUri( 'css/main.css' ), |
|
| 101 | - apply_filters( 'castor/enqueue/css/deps', [] ), |
|
| 99 | + wp_enqueue_style('castor/main.css', |
|
| 100 | + Theme::assetUri('css/main.css'), |
|
| 101 | + apply_filters('castor/enqueue/css/deps', []), |
|
| 102 | 102 | null |
| 103 | 103 | ); |
| 104 | - wp_enqueue_script( 'castor/main.js', |
|
| 105 | - Theme::assetUri( 'js/main.js' ), |
|
| 106 | - apply_filters( 'castor/enqueue/js/deps', [] ), |
|
| 104 | + wp_enqueue_script('castor/main.js', |
|
| 105 | + Theme::assetUri('js/main.js'), |
|
| 106 | + apply_filters('castor/enqueue/js/deps', []), |
|
| 107 | 107 | null, |
| 108 | 108 | true |
| 109 | 109 | ); |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @return void |
| 114 | 114 | * @action customize_register |
| 115 | 115 | */ |
| 116 | - public function registerCustomizer( WP_Customize_Manager $manager ) |
|
| 116 | + public function registerCustomizer(WP_Customize_Manager $manager) |
|
| 117 | 117 | { |
| 118 | - $manager->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 119 | - $manager->selective_refresh->add_partial( 'blogname', [ |
|
| 118 | + $manager->get_setting('blogname')->transport = 'postMessage'; |
|
| 119 | + $manager->selective_refresh->add_partial('blogname', [ |
|
| 120 | 120 | 'selector' => '.brand', |
| 121 | 121 | 'render_callback' => function() { |
| 122 | - bloginfo( 'name' ); |
|
| 122 | + bloginfo('name'); |
|
| 123 | 123 | }, |
| 124 | 124 | ]); |
| 125 | 125 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function registerCustomizerAssets() |
| 132 | 132 | { |
| 133 | - wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true ); |
|
| 133 | + wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -139,23 +139,23 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function registerSidebars() |
| 141 | 141 | { |
| 142 | - $defaults = apply_filters( 'castor/register/sidebars/defaults', [ |
|
| 142 | + $defaults = apply_filters('castor/register/sidebars/defaults', [ |
|
| 143 | 143 | 'before_widget' => '<div class="widget %1$s %2$s">', |
| 144 | 144 | 'after_widget' => '</div>', |
| 145 | 145 | 'before_title' => '<h4>', |
| 146 | 146 | 'after_title' => '</h4>', |
| 147 | 147 | ]); |
| 148 | 148 | |
| 149 | - $sidebars = apply_filters( 'castor/register/sidebars', [ |
|
| 150 | - 'sidebar-primary' => __( 'Primary Sidebar', 'castor' ), |
|
| 151 | - 'sidebar-footer' => __( 'Footer Sidebar', 'castor' ), |
|
| 149 | + $sidebars = apply_filters('castor/register/sidebars', [ |
|
| 150 | + 'sidebar-primary' => __('Primary Sidebar', 'castor'), |
|
| 151 | + 'sidebar-footer' => __('Footer Sidebar', 'castor'), |
|
| 152 | 152 | ]); |
| 153 | 153 | |
| 154 | - foreach( $sidebars as $id => $name ) { |
|
| 154 | + foreach ($sidebars as $id => $name) { |
|
| 155 | 155 | register_sidebar([ |
| 156 | 156 | 'id' => $id, |
| 157 | 157 | 'name' => $name, |
| 158 | - ] + $defaults ); |
|
| 158 | + ] + $defaults); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -22,65 +22,65 @@ |
||
| 22 | 22 | 'width', |
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | - public function __construct( Utility $utility ) |
|
| 25 | + public function __construct(Utility $utility) |
|
| 26 | 26 | { |
| 27 | 27 | $this->oembed = _wp_oembed_get_object(); |
| 28 | 28 | $this->utility = $utility; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function request( $url, $args = '' ) |
|
| 31 | + public function request($url, $args = '') |
|
| 32 | 32 | { |
| 33 | - $request = $this->oembed->fetch( $this->oembed->get_provider( $url ), $url, [ |
|
| 33 | + $request = $this->oembed->fetch($this->oembed->get_provider($url), $url, [ |
|
| 34 | 34 | 'width' => 1280, |
| 35 | 35 | 'height' => 1280, |
| 36 | 36 | ]); |
| 37 | - if( $request ) { |
|
| 38 | - return $this->modifyRequest( $request, $args ); |
|
| 37 | + if ($request) { |
|
| 38 | + return $this->modifyRequest($request, $args); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected function domLoad( $html ) |
|
| 42 | + protected function domLoad($html) |
|
| 43 | 43 | { |
| 44 | 44 | $dom = new DomDocument; |
| 45 | - $dom->loadHTML( $html ); |
|
| 45 | + $dom->loadHTML($html); |
|
| 46 | 46 | return $dom; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - protected function modifyRequest( $request, $args ) |
|
| 49 | + protected function modifyRequest($request, $args) |
|
| 50 | 50 | { |
| 51 | - $providerName = strtolower( $request->provider_name ); |
|
| 52 | - $provider = property_exists( $this, $providerName ) |
|
| 51 | + $providerName = strtolower($request->provider_name); |
|
| 52 | + $provider = property_exists($this, $providerName) |
|
| 53 | 53 | ? $this->$providerName |
| 54 | 54 | : []; |
| 55 | 55 | |
| 56 | - $method = $this->utility->buildMethodName( $providerName . '_request', 'modify' ); |
|
| 56 | + $method = $this->utility->buildMethodName($providerName . '_request', 'modify'); |
|
| 57 | 57 | |
| 58 | - if( method_exists( $this, $method )) { |
|
| 59 | - return call_user_func( [$this, $method], $request, array_intersect_key( |
|
| 60 | - wp_parse_args( $args ), |
|
| 61 | - array_flip( $provider ) |
|
| 58 | + if (method_exists($this, $method)) { |
|
| 59 | + return call_user_func([$this, $method], $request, array_intersect_key( |
|
| 60 | + wp_parse_args($args), |
|
| 61 | + array_flip($provider) |
|
| 62 | 62 | )); |
| 63 | 63 | } |
| 64 | 64 | return $request; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - protected function modifyYoutubeRequest( $request, array $args ) |
|
| 67 | + protected function modifyYoutubeRequest($request, array $args) |
|
| 68 | 68 | { |
| 69 | - $html = $this->domLoad( $request->html ); |
|
| 70 | - $node = $html->getElementsByTagName( 'iframe' )->item(0); |
|
| 71 | - $url = $node->getAttribute( 'src' ); |
|
| 69 | + $html = $this->domLoad($request->html); |
|
| 70 | + $node = $html->getElementsByTagName('iframe')->item(0); |
|
| 71 | + $url = $node->getAttribute('src'); |
|
| 72 | 72 | |
| 73 | - if( isset( $args['fs'] ) && $args['fs'] == 0 ) { |
|
| 74 | - $node->removeAttribute( 'allowfullscreen' ); |
|
| 73 | + if (isset($args['fs']) && $args['fs'] == 0) { |
|
| 74 | + $node->removeAttribute('allowfullscreen'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $args['origin'] = urlencode( get_bloginfo( 'url' )); |
|
| 77 | + $args['origin'] = urlencode(get_bloginfo('url')); |
|
| 78 | 78 | |
| 79 | - $node->setAttribute( 'src', |
|
| 80 | - add_query_arg( $args, remove_query_arg( 'feature', $url )) |
|
| 79 | + $node->setAttribute('src', |
|
| 80 | + add_query_arg($args, remove_query_arg('feature', $url)) |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | - $request->html = $html->saveHTML( $node ); |
|
| 83 | + $request->html = $html->saveHTML($node); |
|
| 84 | 84 | |
| 85 | 85 | return $request; |
| 86 | 86 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | protected $image; |
| 22 | 22 | protected $video; |
| 23 | 23 | |
| 24 | - public function __construct( Gallery $gallery, Image $image, Video $video ) |
|
| 24 | + public function __construct(Gallery $gallery, Image $image, Video $video) |
|
| 25 | 25 | { |
| 26 | 26 | $this->gallery = $gallery; |
| 27 | 27 | $this->image = $image; |
@@ -34,21 +34,21 @@ discard block |
||
| 34 | 34 | * @return string|void |
| 35 | 35 | * @throws BadMethodCallException |
| 36 | 36 | */ |
| 37 | - public function __call( $name, array $args ) |
|
| 37 | + public function __call($name, array $args) |
|
| 38 | 38 | { |
| 39 | - $mediaType = $this->validateMethod( $name ); |
|
| 40 | - if( $mediaType === false ) { |
|
| 41 | - throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name )); |
|
| 39 | + $mediaType = $this->validateMethod($name); |
|
| 40 | + if ($mediaType === false) { |
|
| 41 | + throw new BadMethodCallException(sprintf('Not a valid method: %s', $name)); |
|
| 42 | 42 | } |
| 43 | - if( !count( $args )) { |
|
| 44 | - throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name )); |
|
| 43 | + if (!count($args)) { |
|
| 44 | + throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name)); |
|
| 45 | 45 | } |
| 46 | - if( str_replace( $mediaType, '', strtolower( $name ))) { |
|
| 47 | - return $this->$mediaType->get( $args[0] )->$mediaType; |
|
| 46 | + if (str_replace($mediaType, '', strtolower($name))) { |
|
| 47 | + return $this->$mediaType->get($args[0])->$mediaType; |
|
| 48 | 48 | } |
| 49 | - return !empty( $args[1] ) |
|
| 50 | - ? $this->$mediaType->get( $args[0] )->render( $args[1] ) |
|
| 51 | - : $this->$mediaType->get( $args[0] )->render(); |
|
| 49 | + return !empty($args[1]) |
|
| 50 | + ? $this->$mediaType->get($args[0])->render($args[1]) |
|
| 51 | + : $this->$mediaType->get($args[0])->render(); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return mixed |
| 59 | 59 | */ |
| 60 | - public function get( $name, $args = [] ) |
|
| 60 | + public function get($name, $args = []) |
|
| 61 | 61 | { |
| 62 | - if( $mediaType = $this->validateMethod( $name )) { |
|
| 63 | - return $this->$mediaType->get( $args )->$mediaType; |
|
| 62 | + if ($mediaType = $this->validateMethod($name)) { |
|
| 63 | + return $this->$mediaType->get($args)->$mediaType; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return string|false |
| 71 | 71 | */ |
| 72 | - protected function validateMethod( $name ) |
|
| 72 | + protected function validateMethod($name) |
|
| 73 | 73 | { |
| 74 | - foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) { |
|
| 75 | - if( in_array( $method, ['gallery', 'image', 'video'] ) |
|
| 76 | - && property_exists( $this, $method ) |
|
| 77 | - && is_object( $this->$method )) { |
|
| 74 | + foreach ([$name, strtolower(substr($name, 3))] as $method) { |
|
| 75 | + if (in_array($method, ['gallery', 'image', 'video']) |
|
| 76 | + && property_exists($this, $method) |
|
| 77 | + && is_object($this->$method)) { |
|
| 78 | 78 | return $method; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | protected $postmeta; |
| 13 | 13 | protected $utility; |
| 14 | 14 | |
| 15 | - public function __construct( PostMeta $postmeta, Utility $utility ) |
|
| 15 | + public function __construct(PostMeta $postmeta, Utility $utility) |
|
| 16 | 16 | { |
| 17 | 17 | $this->postmeta = $postmeta; |
| 18 | 18 | $this->utility = $utility; |
@@ -23,43 +23,43 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return self |
| 25 | 25 | */ |
| 26 | - public function get( $attachment ) |
|
| 26 | + public function get($attachment) |
|
| 27 | 27 | { |
| 28 | - if( !( $attachment = $this->normalize( $attachment )))return; |
|
| 29 | - if( $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' )) { |
|
| 30 | - $medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'medium' ), $thumbnail ); |
|
| 31 | - $large = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'large' ), $medium ); |
|
| 28 | + if (!($attachment = $this->normalize($attachment)))return; |
|
| 29 | + if ($thumbnail = wp_get_attachment_image_src($attachment, 'thumbnail')) { |
|
| 30 | + $medium = $this->normalizeSrc(wp_get_attachment_image_src($attachment, 'medium'), $thumbnail); |
|
| 31 | + $large = $this->normalizeSrc(wp_get_attachment_image_src($attachment, 'large'), $medium); |
|
| 32 | 32 | |
| 33 | 33 | $this->image = (object) [ |
| 34 | - 'alt' => wp_strip_all_tags( get_post_meta( $attachment, '_wp_attachment_image_alt', true ), true ), |
|
| 35 | - 'caption' => wp_get_attachment_caption( $attachment ), |
|
| 36 | - 'copyright' => wp_strip_all_tags( get_post_meta( $attachment, '_copyright', true ), true ), |
|
| 34 | + 'alt' => wp_strip_all_tags(get_post_meta($attachment, '_wp_attachment_image_alt', true), true), |
|
| 35 | + 'caption' => wp_get_attachment_caption($attachment), |
|
| 36 | + 'copyright' => wp_strip_all_tags(get_post_meta($attachment, '_copyright', true), true), |
|
| 37 | 37 | 'ID' => $attachment, |
| 38 | 38 | 'large' => $large, |
| 39 | 39 | 'medium' => $medium, |
| 40 | - 'permalink' => get_attachment_link( $attachment ), |
|
| 41 | - 'thumbnail' => $this->normalizeSrc( $thumbnail ), |
|
| 40 | + 'permalink' => get_attachment_link($attachment), |
|
| 41 | + 'thumbnail' => $this->normalizeSrc($thumbnail), |
|
| 42 | 42 | ]; |
| 43 | 43 | } |
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function render( $size = 'large' ) |
|
| 47 | + public function render($size = 'large') |
|
| 48 | 48 | { |
| 49 | - if( $this->image ) { |
|
| 50 | - return wp_get_attachment_image( $this->image->ID, $size ); |
|
| 49 | + if ($this->image) { |
|
| 50 | + return wp_get_attachment_image($this->image->ID, $size); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - protected function normalize( $attachmentId ) |
|
| 54 | + protected function normalize($attachmentId) |
|
| 55 | 55 | { |
| 56 | - if( !filter_var( $attachmentId, FILTER_VALIDATE_INT )) { |
|
| 57 | - $attachmentId = $this->postmeta->get( $attachmentId ); |
|
| 56 | + if (!filter_var($attachmentId, FILTER_VALIDATE_INT)) { |
|
| 57 | + $attachmentId = $this->postmeta->get($attachmentId); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $attachment = get_post( $attachmentId ); |
|
| 60 | + $attachment = get_post($attachmentId); |
|
| 61 | 61 | |
| 62 | - if( is_null( $attachment ) || $attachment->post_type != 'attachment' )return; |
|
| 62 | + if (is_null($attachment) || $attachment->post_type != 'attachment')return; |
|
| 63 | 63 | |
| 64 | 64 | return $attachment->ID; |
| 65 | 65 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return array |
| 71 | 71 | */ |
| 72 | - protected function normalizeSrc( array $image, $fallback = false ) |
|
| 72 | + protected function normalizeSrc(array $image, $fallback = false) |
|
| 73 | 73 | { |
| 74 | - if( is_array( $fallback ) && count( array_diff( $image, $fallback )) < 2 ) { |
|
| 74 | + if (is_array($fallback) && count(array_diff($image, $fallback)) < 2) { |
|
| 75 | 75 | $image = $fallback; |
| 76 | 76 | } |
| 77 | 77 | return [ |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function get( $attachment ) |
| 27 | 27 | { |
| 28 | - if( !( $attachment = $this->normalize( $attachment )))return; |
|
| 28 | + if( !( $attachment = $this->normalize( $attachment ))) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 29 | 31 | if( $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' )) { |
| 30 | 32 | $medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'medium' ), $thumbnail ); |
| 31 | 33 | $large = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'large' ), $medium ); |
@@ -59,7 +61,9 @@ discard block |
||
| 59 | 61 | |
| 60 | 62 | $attachment = get_post( $attachmentId ); |
| 61 | 63 | |
| 62 | - if( is_null( $attachment ) || $attachment->post_type != 'attachment' )return; |
|
| 64 | + if( is_null( $attachment ) || $attachment->post_type != 'attachment' ) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 63 | 67 | |
| 64 | 68 | return $attachment->ID; |
| 65 | 69 | } |