• Resolved forrestuv

    (@forrestuv)


    Hi!
    First of all, nice plugin and thx for keeping it free πŸ™‚
    I have an add_filter on “the_title” that accept two parameters(it’s the correct config)
    For some strange reason when your plugin try to render markers, wordpress fire an error saying that “the_title” needs two parameters.
    I looked inside your code and noticed that you use “the_title” twice (apply_filter).

    Can you please tell me how to fix this issue, or can you please fix it?
    In any case I cannot remove my add_filter function, since it’s very important for my site.

    thx

    https://ww.wp.xz.cn/plugins/basic-google-maps-placemarks/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ian Dunn

    (@iandunn)

    Can you copy/paste the exact error here, so I can get a better idea of what’s going on? (Feel free to redact the file path if you prefer, I just need the error message, file name and line number). If it happens multiple times, please post them all.

    Thread Starter forrestuv

    (@forrestuv)

    The error is on my functions.php where I override the_title.
    Missing argument 2 for newTitle() in /home/wp/wp-content/themes/headline-news-child/functions.php on line 21
    That leads to: Basic Google Maps Placemarks error: bgmpData undefined.

    for some reason I cannot override the_title anymore..

    add_filter('the_title', 'newTitle', 10, 2);
    function newTitle($title, $id) <<<line 21
    {
    	$catImgs="";
        if(get_post_type($id)=='post' && are_we_in("the_title"))
    	{
    		if ( !is_admin() && in_the_loop() )
    		{
    			$catImgs=getTitleImages($id);
    		}
    	}
    	return $catImgs.$title;
    }

    removing the apply_filter() in:
    core.php line 2527
    shortcode-bgmp-list-marker.php line 3
    my functions.php (inside child theme) works again..

    analyzing chrome debug console you can notice that the errors halts js execution..

    <div class=”entry-content”>
    <p>test</p>

    <script type=”text/javascript”>
    var bgmpData = {
    options: {“mapWidth”:”600″,”mapHeight”:”400″,”latitude”:”41.9027835″,”longitude”:”12.4963655″,”zoom”:”5″,”type”:”ROADMAP”,”typeControl”:”off”,”navigationControl”:”off”,”infoWindowMaxWidth”:”500″,”streetViewControl”:true,”viewOnMapScroll”:false,”clustering”:{“enabled”:”on”,”maxZoom”:”7″,”gridSize”:”1000″,”style”:”people”,”styles”:{“people”:[{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/people35.png”,”height”:35,”width”:35,”anchor”:[16,0],”textColor”:”#ff00ff”,”textSize”:10},{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/people45.png”,”height”:45,”width”:45,”anchor”:[24,0],”textColor”:”#ff0000″,”textSize”:11},{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/people55.png”,”height”:55,”width”:55,”anchor”:[32,0],”textColor”:”#ffffff”,”textSize”:12}],”conversation”:[{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/conv30.png”,”height”:27,”width”:30,”anchor”:[3,0],”textColor”:”#ff00ff”,”textSize”:10},{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/conv40.png”,”height”:36,”width”:40,”anchor”:[6,0],”textColor”:”#ff0000″,”textSize”:11},{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/conv50.png”,”height”:50,”width”:45,”anchor”:[8,0],”textSize”:12}],”hearts”:[{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/heart30.png”,”height”:26,”width”:30,”anchor”:[4,0],”textColor”:”#ff00ff”,”textSize”:10},{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/heart40.png”,”height”:35,”width”:40,”anchor”:[8,0],”textColor”:”#ff0000″,”textSize”:11},{“url”:”http:\/\/www.xxx.com\/wp\/wp-content\/plugins\/basic-google-maps-placemarks\/includes\/marker-clusterer\/images\/heart50.png”,”height”:50,”width”:44,”anchor”:[12,0],”textSize”:12}]}}},
    markers:
    <b>Warning</b>: Missing argument 2 for newTitle() in <b>/web/htdocs/www.xxx.com/home/wp/wp-content/themes/headline-news-child/functions.php</b> on line <b>21</b>

    <b>Warning</b>: Missing argument 2 for newTitle() in <b>/web/htdocs/www.xxx.com/home/wp/wp-content/themes/headline-news-child/functions.php</b> on line <b>21</b>
    [{“id”:3234,”title”:””,”latitude”:”38.1156879″,”longitude”:”13.3612671″,”details”:””,”categories”:[],”icon”:”http:\/\/www.xxx.com\/wp\/wp-content\/uploads\/2015\/03\/qTag2.gif”,”zIndex”:”0″},{“id”:3221,”title”:””,”latitude”:”38.1156879″,”longitude”:”13.3612671″,”details”:”<p>Descr<\/p>\n”,”categories”:[],”icon”:”http:\/\/www.xxx.com\/wp\/wp-content\/uploads\/2015\/03\/c.gif”,”zIndex”:”0″}] };
    </script>

    <div id=”bgmp_map-canvas”>
    <p>Loading map…</p>

    Thread Starter forrestuv

    (@forrestuv)

    I think that the right solution is to modify your code as follows

    ...
    'title'	=> apply_filters( 'the_title', $pp->post_title, get_the_ID() ),
    ...
    ...
    <?php echo apply_filters( 'the_title', $p->post_title, get_the_ID() ); ?>
    ...

    it seems to work but I haven’t so much experience with WP …
    can you confirm it?

    Plugin Author Ian Dunn

    (@iandunn)

    It doesn’t look like a problem with BGMP, if you look at the error message, it’s coming from your theme:

    Missing argument 2 for newTitle() in /home/wp/wp-content/themes/headline-news-child/functions.php on line 21

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘the_title() problem’ is closed to new replies.