@다케미카코 님이 제작하신 네이버 META 검색 잘 걸리게 하기를 HOOK 기능을 만들어봤습니다.
https://sir.kr/yc5_tip/2326
[code]
// extend/user.extend.php 에 입력
if (! function_exists('common_header_shop_item_meta')) {
add_event('common_header', 'common_header_shop_item_meta');
function common_header_shop_item_meta()
{
global $g5, $config;
if($_REQUEST['it_id'] != "" && (!defined('G5_IS_ADMIN') || G5_IS_ADMIN == false)){
$it_id = $_REQUEST['it_id'];
$http_host = $_SERVER['HTTP_HOST'];
$request_uri = $_SERVER['REQUEST_URI'];
$ogUrl = 'https://' . $http_host . $request_uri;
$sql = "select * from g5_shop_item where it_id='$it_id'";
$item = sql_fetch($sql); // 쿼리 실행
$ogType = 'website'; // default website
$ogTitle = $g5['title'];
$ogImage = ''; // default image url 입력
if ($item) {
$ogTitle = $item['it_name'];
$ogImage = get_it_imageurl($it_id);
}
$config['cf_add_meta'] .= '<meta property="og:url" content="'.$ogUrl.'" />';
$config['cf_add_meta'] .= '<meta property="og:type" content="'.$ogType.'" />';
$config['cf_add_meta'] .= '<meta property="og:title" content="'.$ogTitle.'"/>';
$config['cf_add_meta'] .= '<meta property="og:image" content="'.$ogImage.'"/>';
}
}
}
[/code]
이상 있으시면 댓글 남겨 주세요.
댓글 38개
게시글 목록
| 번호 | 제목 |
|---|---|
| 2503 | |
| 2501 | |
| 2497 | |
| 2495 | |
| 2491 | |
| 2490 | |
| 2489 | |
| 2486 | |
| 2484 | |
| 2483 | |
| 2481 | |
| 2476 | |
| 2475 | |
| 2474 | |
| 2472 | |
| 2469 | |
| 2467 | |
| 2466 | |
| 2465 | |
| 2464 | |
| 2463 | |
| 2460 | |
| 2459 | |
| 2456 | |
| 2449 | |
| 2446 | |
| 2441 | |
| 2420 | |
| 2419 | |
| 2417 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기