@다케미카코 님이 제작하신 네이버 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개
게시글 목록
| 번호 | 제목 |
|---|---|
| 1874 | |
| 1873 | |
| 1870 | |
| 1862 | |
| 1846 | |
| 1845 | |
| 1837 | |
| 1835 | |
| 1823 | |
| 1787 | |
| 1781 | |
| 1777 | |
| 1771 | |
| 1750 | |
| 1746 | |
| 1743 | |
| 1742 | |
| 1738 | |
| 1714 | |
| 1710 | |
| 1700 | |
| 1699 | |
| 1696 | |
| 1694 | |
| 1691 | |
| 1684 | |
| 1662 | |
| 1659 | |
| 1656 | |
| 1637 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기